Skip to contentSkip to conversation

fio: add job_runtime to the thread json output

PATCH Applied Josef Bacik 2 participants 2 messages Jun 29, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fio: add job_runtime to the thread json output

I discovered that the 'elapsed' value of each job is the overall time the whole fio run took, not the per-job elapsed time, despite it being in the per-job section of the json output. Rather than break everybody by fixing this, just add a 'job_runtime' value to the job section and include the time the thread ran in milliseconds. This is handy for jobs that want to compare runtime of two threads in different cgroups.

---
v1->v2:
- use 'job_runtime' instead of 'total_run_time'

 stat.c | 1 +
 1 file changed, 1 insertion(+)
stat.c +1 -0
index d5240d96a25b..a308eb884557 100644
@@ -1288,6 +1288,7 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts,
 		usr_cpu = 0;
 		sys_cpu = 0;
 	}
+	json_object_add_value_int(root, "job_runtime", ts->total_run_time);
 	json_object_add_value_float(root, "usr_cpu", usr_cpu);
 	json_object_add_value_float(root, "sys_cpu", sys_cpu);
 	json_object_add_value_int(root, "ctx", ts->ctx);
Signature · 1 line
2.14.3
Applied
#1 lore raw
Quoted 6 lines · Josef Bacik

I discovered that the 'elapsed' value of each job is the overall time the whole fio run took, not the per-job elapsed time, despite it being in the per-job section of the json output. Rather than break everybody by fixing this, just add a 'job_runtime' value to the job section and include the time the thread ran in milliseconds. This is handy for jobs that want to compare runtime of two threads in different cgroups.

Quick turn-around :-)

Applied!

Signature · 1 line
Jens Axboe