stat: Modify info for bw and add iops stats
v3 cover stat: Modify info for bw and add iops stats
Hi,
this is a resubmission of patches 1 and 2 to add iops statistics and number of samples for iops and bw stats to normal and json output formats. Patches are rebased on fio-2.21-26-gcf6b7fb4.
I'd like to see similar information added to terse format. Thus I've added patches 3 and 4. First to merge terse functions (reducing code size) and then to add a new terse format 5 where iops stats and number of samples for bw and iops are displayed.
Regards,
Andreas
PATCH v3 1/4 stat: Print one-line iops stat
This adds basic iops statistics (likewise to what we already have for bandwidth) to normal and json fio output. Example for normal output:
bw ( KiB/s): min=42192, max=162068, per=0.10%, avg=93236.21, stdev=22180.02 iops : min=21090, max=81020, avg=46606.84, stdev=11088.40
lat (usec) : 2=55.13%, 4=21.11%, 10=0.36%, 20=0.03%, 50=23.14%
--- init.c | 1 + server.c | 1 + stat.c | 16 ++++++++++++++++ 3 files changed, 18 insertions(+)
init.c +1 -0
@@ -1364,6 +1364,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, td->ts.slat_stat[i].min_val =ULONG_MAX ; td->ts.lat_stat[i].min_val =ULONG_MAX ; td->ts.bw_stat[i].min_val =ULONG_MAX ; + td->ts.iops_stat[i].min_val =ULONG_MAX ; } td->ddir_seq_nr = o->ddir_seq_nr;
server.c +1 -0
@@ -1474,6 +1474,7 @@ void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs)convert_io_stat (&p.ts.slat_stat[i], &ts->slat_stat[i]);convert_io_stat (&p.ts.lat_stat[i], &ts->lat_stat[i]);convert_io_stat (&p.ts.bw_stat[i], &ts->bw_stat[i]); +convert_io_stat (&p.ts.iops_stat[i], &ts->iops_stat[i]); } p.ts.usr_time =cpu_to_le64 (ts->usr_time);
stat.c +16 -0
@@ -499,6 +499,10 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,log_buf (out," bw (%5s/s): min=%5llu, max=%5llu, per=%3.2f%%, avg=%5.02f, stdev=%5.02f\n" , bw_str, min, max, p_of_agg, mean, dev); } +if (calc_lat (&ts->iops_stat[ddir], &min, &max, &mean, &dev)) { +log_buf (out," iops : min=%5llu, max=%5llu, avg=%5.02f, " +"stdev=%5.02f\n" , min, max, mean, dev); + } } static int show_lat(double *io_u_lat, int nr, const char **ranges,
@@ -1047,6 +1051,15 @@ static void add_ddir_status_json(struct thread_stat *ts,json_object_add_value_float (dir_object,"bw_agg" , p_of_agg);json_object_add_value_float (dir_object,"bw_mean" , mean);json_object_add_value_float (dir_object,"bw_dev" , dev); + +if (!calc_lat (&ts->iops_stat[ddir], &min, &max, &mean, &dev)) { + min = max =0 ; + mean = dev =0.0 ; + } +json_object_add_value_int (dir_object,"iops_min" , min); +json_object_add_value_int (dir_object,"iops_max" , max); +json_object_add_value_float (dir_object,"iops_mean" , mean); +json_object_add_value_float (dir_object,"iops_stddev" , dev); } static void show_thread_status_terse_v2(struct thread_stat *ts,
@@ -1507,6 +1520,7 @@ void sum_thread_stats(struct thread_stat *dst, struct thread_stat *src,sum_stat (&dst->slat_stat[l], &src->slat_stat[l], first);sum_stat (&dst->lat_stat[l], &src->lat_stat[l], first);sum_stat (&dst->bw_stat[l], &src->bw_stat[l], first); +sum_stat (&dst->iops_stat[l], &src->iops_stat[l], first); dst->io_bytes[l] += src->io_bytes[l];
@@ -1517,6 +1531,7 @@ void sum_thread_stats(struct thread_stat *dst, struct thread_stat *src,sum_stat (&dst->slat_stat[0 ], &src->slat_stat[l], first);sum_stat (&dst->lat_stat[0 ], &src->lat_stat[l], first);sum_stat (&dst->bw_stat[0 ], &src->bw_stat[l], first); +sum_stat (&dst->iops_stat[0 ], &src->iops_stat[l], first); dst->io_bytes[0 ] += src->io_bytes[l];
@@ -1598,6 +1613,7 @@ void init_thread_stat(struct thread_stat *ts) ts->clat_stat[j].min_val =-1UL ; ts->slat_stat[j].min_val =-1UL ; ts->bw_stat[j].min_val =-1UL ; + ts->iops_stat[j].min_val =-1UL ; } ts->groupid =-1 ; }
Signature · 1 line
2.12.0
PATCH v3 2/4 stat: Print number of samples in bw and iops stats
In reply to Andreas HerrmannThis adds the actual number of samples for bw and iops stats printed in normal and json fio output. Example for normal output:
bw ( MiB/s): min= 120, max= 3304, per=0.10%, avg=2659.34, stdev=1085.25, samples= 109
iops : min=102776, max=830416, avg=675639.05, stdev=280619.99, samples= 21
Note: This example was created using options "--write_bw_log=... --log_avg_msec=100 --runtime=11s" (ie. no iops log written). That is why number of samples differs for IOPs and BW.
--- stat.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
stat.c +10 -3
@@ -496,12 +496,15 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts, bw_str = (rs->unit_base ==1 ?"Mibit" :"MiB" ); } -log_buf (out," bw (%5s/s): min=%5llu, max=%5llu, per=%3.2f%%, avg=%5.02f, stdev=%5.02f\n" , - bw_str, min, max, p_of_agg, mean, dev); +log_buf (out," bw (%5s/s): min=%5llu, max=%5llu, per=%3.2f%%, " +"avg=%5.02f, stdev=%5.02f, samples=%5lu\n" , + bw_str, min, max, p_of_agg, mean, dev, + (&ts->bw_stat[ddir])->samples); }if (calc_lat (&ts->iops_stat[ddir], &min, &max, &mean, &dev)) {log_buf (out," iops : min=%5llu, max=%5llu, avg=%5.02f, " -"stdev=%5.02f\n" , min, max, mean, dev); +"stdev=%5.02f, samples=%5lu\n" , + min, max, mean, dev, (&ts->iops_stat[ddir])->samples); } }
@@ -1051,6 +1054,8 @@ static void add_ddir_status_json(struct thread_stat *ts,json_object_add_value_float (dir_object,"bw_agg" , p_of_agg);json_object_add_value_float (dir_object,"bw_mean" , mean);json_object_add_value_float (dir_object,"bw_dev" , dev); +json_object_add_value_int (dir_object,"bw_samples" , + (&ts->bw_stat[ddir])->samples);if (!calc_lat (&ts->iops_stat[ddir], &min, &max, &mean, &dev)) { min = max =0 ;
@@ -1060,6 +1065,8 @@ static void add_ddir_status_json(struct thread_stat *ts,json_object_add_value_int (dir_object,"iops_max" , max);json_object_add_value_float (dir_object,"iops_mean" , mean);json_object_add_value_float (dir_object,"iops_stddev" , dev); +json_object_add_value_int (dir_object,"iops_samples" , + (&ts->iops_stat[ddir])->samples); } static void show_thread_status_terse_v2(struct thread_stat *ts,
Signature · 1 line
2.12.0
PATCH v3 3/4 stat: Merge show_thread_status_terse_* functions
In reply to Andreas HerrmannMerge show_thread_status_terse_v2 and show_thread_status_terse_v3_v4 into new function show_thread_status_terse_all.
--- stat.c | 88 ++++++++++++------------------------------------------------------ 1 file changed, 15 insertions(+), 73 deletions(-)
stat.c +15 -73
@@ -1069,9 +1069,9 @@ static void add_ddir_status_json(struct thread_stat *ts, (&ts->iops_stat[ddir])->samples); } -static void show_thread_status_terse_v2 (struct thread_stat *ts, -struct group_run_stats *rs, -struct buf_output *out) +static void show_thread_status_terse_all (struct thread_stat *ts, +struct group_run_stats *rs,int ver, +struct buf_output *out) {double io_u_dist[FIO_IO_U_MAP_NR ];double io_u_lat_u[FIO_IO_U_LAT_U_NR ];
@@ -1080,77 +1080,18 @@ static void show_thread_status_terse_v2(struct thread_stat *ts,int i;/* General Info */ -log_buf (out,"2;%s;%d;%d" , ts->name, ts->groupid, ts->error); -/* Log Read Status */ -show_ddir_status_terse (ts, rs,DDIR_READ , out); -/* Log Write Status */ -show_ddir_status_terse (ts, rs,DDIR_WRITE , out); -/* Log Trim Status */ -show_ddir_status_terse (ts, rs,DDIR_TRIM , out); - -/* CPU Usage */ -if (ts->total_run_time) { -double runt = (double ) ts->total_run_time; - - usr_cpu = (double ) ts->usr_time *100 / runt; - sys_cpu = (double ) ts->sys_time *100 / runt; - }else { - usr_cpu =0 ; - sys_cpu =0 ; - } - -log_buf (out,";%f%%;%f%%;%llu;%llu;%llu" , usr_cpu, sys_cpu, - (unsigned long long ) ts->ctx, - (unsigned long long ) ts->majf, - (unsigned long long ) ts->minf); - -/* Calc % distribution of IO depths, usecond, msecond latency */ -stat_calc_dist (ts->io_u_map,ddir_rw_sum (ts->total_io_u), io_u_dist); -stat_calc_lat_nu (ts, io_u_lat_u); -stat_calc_lat_m (ts, io_u_lat_m); - -/* Only show fixed 7 I/O depth levels*/ -log_buf (out,";%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%" , - io_u_dist[0 ], io_u_dist[1 ], io_u_dist[2 ], io_u_dist[3 ], - io_u_dist[4 ], io_u_dist[5 ], io_u_dist[6 ]); - -/* Microsecond latency */ -for (i =0 ; i <FIO_IO_U_LAT_U_NR ; i++) -log_buf (out,";%3.2f%%" , io_u_lat_u[i]); -/* Millisecond latency */ -for (i =0 ; i <FIO_IO_U_LAT_M_NR ; i++) -log_buf (out,";%3.2f%%" , io_u_lat_m[i]); -/* Additional output if continue_on_error set - default off*/ -if (ts->continue_on_error) -log_buf (out,";%llu;%d" , (unsigned long long ) ts->total_err_count, ts->first_error); -log_buf (out,"\n" ); - -/* Additional output if description is set */ -if (strlen (ts->description)) -log_buf (out,";%s" , ts->description); - -log_buf (out,"\n" ); -} - -static void show_thread_status_terse_v3_v4 (struct thread_stat *ts, -struct group_run_stats *rs,int ver, -struct buf_output *out) -{ -double io_u_dist[FIO_IO_U_MAP_NR ]; -double io_u_lat_u[FIO_IO_U_LAT_U_NR ]; -double io_u_lat_m[FIO_IO_U_LAT_M_NR ]; -double usr_cpu, sys_cpu; -int i; +if (ver ==2 ) +log_buf (out,"2;%s;%d;%d" , ts->name, ts->groupid, ts->error); +else +log_buf (out,"%d;%s;%s;%d;%d" , ver, fio_version_string, + ts->name, ts->groupid, ts->error); -/* General Info */ -log_buf (out,"%d;%s;%s;%d;%d" , ver, fio_version_string, - ts->name, ts->groupid, ts->error);/* Log Read Status */ show_ddir_status_terse (ts, rs,DDIR_READ , out);/* Log Write Status */ show_ddir_status_terse (ts, rs,DDIR_WRITE , out);/* Log Trim Status */ -if (ver ==4 ) +if (ver ==2 || ver ==4 )show_ddir_status_terse (ts, rs,DDIR_TRIM , out);/* CPU Usage */
@@ -1187,11 +1128,14 @@ static void show_thread_status_terse_v3_v4(struct thread_stat *ts,log_buf (out,";%3.2f%%" , io_u_lat_m[i]);/* disk util stats, if any */ -show_disk_util (1 ,NULL , out); +if (ver >=3 ) +show_disk_util (1 ,NULL , out);/* Additional output if continue_on_error set - default off*/ if (ts->continue_on_error)log_buf (out,";%llu;%d" , (unsigned long long ) ts->total_err_count, ts->first_error); +if (ver ==2 ) +log_buf (out,"\n" );/* Additional output if description is set */ if (strlen (ts->description))
@@ -1432,10 +1376,8 @@ static void show_thread_status_terse(struct thread_stat *ts, struct group_run_stats *rs, struct buf_output *out) { -if (terse_version ==2 ) -show_thread_status_terse_v2 (ts, rs, out); -else if (terse_version ==3 || terse_version ==4 ) -show_thread_status_terse_v3_v4 (ts, rs, terse_version, out); +if (terse_version >=2 && terse_version <=4 ) +show_thread_status_terse_all (ts, rs, terse_version, out);else log_err ("fio: bad terse version!? %d\n" , terse_version); }
Signature · 1 line
2.12.0
PATCH v3 4/4 stat: Add iops stat and sample number information to terse format
In reply to Andreas HerrmannThis is inserted beyond bandwidth information. It required creation of a new terse version (v5).
Updated man page and HOWTO accordingly.
--- HOWTO | 2 +- fio.1 | 2 +- init.c | 3 +-- stat.c | 28 +++++++++++++++++++++------- 4 files changed, 24 insertions(+), 11 deletions(-)
HOWTO +1 -1
@@ -127,7 +127,7 @@ Command line options .. option:: --terse-version=type - Set terse version output format (default 3, or 2 or 4). + Set terse version output format (default 3, or 2 or 4 or 5). .. option:: --version
fio.1 +1 -1
@@ -43,7 +43,7 @@ Deprecated, use \-\-output-format instead to select multiple formats. Display version information and exit. .TP .BI \-\-terse\-version \fR=\fPversion -Set terse version output format (default 3, or 2 or 4) +Set terse version output format (default 3, or 2, 4, 5) .TP .B \-\-help Display usage information and exit.
init.c +1 -2
@@ -2404,8 +2404,7 @@ int parse_cmd_line(int argc, char *argv[], int client_type)break ;case 'V' : terse_version =atoi (optarg); -if (!(terse_version ==2 || terse_version ==3 || - terse_version ==4 )) { +if (!(terse_version >=2 && terse_version <=5 )) {log_err ("fio: bad terse version format\n" ); exit_val =1 ; do_exit++;
stat.c +21 -7
@@ -863,13 +863,13 @@ static void show_thread_status_normal(struct thread_stat *ts,static void show_ddir_status_terse (struct thread_stat *ts,struct group_run_stats *rs,int ddir, -struct buf_output *out) +int ver,struct buf_output *out) {unsigned long long min, max, minv, maxv, bw, iops;unsigned long long *ovals =NULL ;double mean, dev;unsigned int len; -int i; +int i, bw_stat;assert (ddir_rw (ddir));
@@ -919,7 +919,8 @@ static void show_ddir_status_terse(struct thread_stat *ts,if (ovals)free (ovals); -if (calc_lat (&ts->bw_stat[ddir], &min, &max, &mean, &dev)) { + bw_stat =calc_lat (&ts->bw_stat[ddir], &min, &max, &mean, &dev); +if (bw_stat) {double p_of_agg =100.0 ;if (rs->agg[ddir]) {
@@ -931,6 +932,19 @@ static void show_ddir_status_terse(struct thread_stat *ts,log_buf (out,";%llu;%llu;%f%%;%f;%f" , min, max, p_of_agg, mean, dev); }else log_buf (out,";%llu;%llu;%f%%;%f;%f" ,0ULL ,0ULL ,0.0 ,0.0 ,0.0 ); + +if (ver ==5 ) { +if (bw_stat) +log_buf (out,";%lu" , (&ts->bw_stat[ddir])->samples); +else +log_buf (out,";%lu" ,0UL ); + +if (calc_lat (&ts->iops_stat[ddir], &min, &max, &mean, &dev)) +log_buf (out,";%llu;%llu;%f;%f;%lu" , min, max, + mean, dev, (&ts->iops_stat[ddir])->samples); +else +log_buf (out,";%llu;%llu;%f;%f;%lu" ,0ULL ,0ULL ,0.0 ,0.0 ,0UL ); + } } static void add_ddir_status_json(struct thread_stat *ts,
@@ -1087,12 +1101,12 @@ static void show_thread_status_terse_all(struct thread_stat *ts, ts->name, ts->groupid, ts->error);/* Log Read Status */ -show_ddir_status_terse (ts, rs,DDIR_READ , out); +show_ddir_status_terse (ts, rs,DDIR_READ , ver, out);/* Log Write Status */ -show_ddir_status_terse (ts, rs,DDIR_WRITE , out); +show_ddir_status_terse (ts, rs,DDIR_WRITE , ver, out);/* Log Trim Status */ if (ver ==2 || ver ==4 ) -show_ddir_status_terse (ts, rs,DDIR_TRIM , out); +show_ddir_status_terse (ts, rs,DDIR_TRIM , ver, out);/* CPU Usage */ if (ts->total_run_time) {
@@ -1376,7 +1390,7 @@ static void show_thread_status_terse(struct thread_stat *ts, struct group_run_stats *rs, struct buf_output *out) { -if (terse_version >=2 && terse_version <=4 ) +if (terse_version >=2 && terse_version <=5 )show_thread_status_terse_all (ts, rs, terse_version, out);else log_err ("fio: bad terse version!? %d\n" , terse_version);
Signature · 1 line
2.12.0
Quoted 10 lines · Andreas Herrmann
Hi,
this is a resubmission of patches 1 and 2 to add iops statistics and number of samples for iops and bw stats to normal and json output formats. Patches are rebased on fio-2.21-26-gcf6b7fb4.
I'd like to see similar information added to terse format. Thus I've added patches 3 and 4. First to merge terse functions (reducing code size) and then to add a new terse format 5 where iops stats and number of samples for bw and iops are displayed.
Looks good, I like it. Patch #4 needs an explanation of version 5 of the terse format, though. Care to add that?
Signature · 1 line
Jens Axboe
Re: [PATCH 1/4] stat: Print one-line iops stat
In reply to Andreas HerrmannQuoted 31 lines · Andreas Herrmann
This adds basic iops statistics (likewise to what we already have for bandwidth) to normal and json fio output. Example for normal output:
bw ( KiB/s): min=42192, max=162068, per=0.10%, avg=93236.21, stdev=22180.02 iops : min=21090, max=81020, avg=46606.84, stdev=11088.40 lat (usec) : 2=55.13%, 4=21.11%, 10=0.36%, 20=0.03%, 50=23.14%Signed-off-by Andreas Herrmann <[email protected]>--- init.c | 1 + server.c | 1 + stat.c | 16 ++++++++++++++++ 3 files changed, 18 insertions(+)init.c +1
-0@@ -1364,6 +1364,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, td->ts.slat_stat[i].min_val =ULONG_MAX ; td->ts.lat_stat[i].min_val =ULONG_MAX ; td->ts.bw_stat[i].min_val =ULONG_MAX ; + td->ts.iops_stat[i].min_val =ULONG_MAX ; } td->ddir_seq_nr = o->ddir_seq_nr;server.c +0
-0
server.c void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs) · line 1480
Quoted 7 lines
server.c +1
-0@@ -1474,6 +1474,7 @@ void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs)convert_io_stat (&p.ts.slat_stat[i], &ts->slat_stat[i]);convert_io_stat (&p.ts.lat_stat[i], &ts->lat_stat[i]);convert_io_stat (&p.ts.bw_stat[i], &ts->bw_stat[i]); +convert_io_stat (&p.ts.iops_stat[i], &ts->iops_stat[i]); } p.ts.usr_time =cpu_to_le64 (ts->usr_time);
You're missing the equivelant client conversion. Also, you need to bump the server version with this change.
Signature · 1 line
Jens Axboe
Quoted 7 lines · Jens Axboe
Quoted 6 lines · Andreas Herrmann
Hi,
this is a resubmission of patches 1 and 2 to add iops statistics and number of samples for iops and bw stats to normal and json output formats. Patches are rebased on fio-2.21-26-gcf6b7fb4.
Quoted 7 lines
Quoted 4 lines
I'd like to see similar information added to terse format. Thus I've added patches 3 and 4. First to merge terse functions (reducing code size) and then to add a new terse format 5 where iops stats and number of samples for bw and iops are displayed.
Looks good, I like it. Patch #4 needs an explanation of version 5 of the terse format, though. Care to add that?
You mean for the commit message or for the man-page or both? For the latter I think the differences between the different terse versions should be described. (Maybe I missed it but I think that is not in the man-page).
Andreas
Re: [PATCH 1/4] stat: Print one-line iops stat
In reply to Jens AxboeQuoted 38 lines · Jens Axboe
Quoted 37 lines · Andreas Herrmann
This adds basic iops statistics (likewise to what we already have for bandwidth) to normal and json fio output. Example for normal output:
bw ( KiB/s): min=42192, max=162068, per=0.10%, avg=93236.21, stdev=22180.02 iops : min=21090, max=81020, avg=46606.84, stdev=11088.40 lat (usec) : 2=55.13%, 4=21.11%, 10=0.36%, 20=0.03%, 50=23.14%Signed-off-by Andreas Herrmann <[email protected]>--- init.c | 1 + server.c | 1 + stat.c | 16 ++++++++++++++++ 3 files changed, 18 insertions(+)init.c +1
-0@@ -1364,6 +1364,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, td->ts.slat_stat[i].min_val =ULONG_MAX ; td->ts.lat_stat[i].min_val =ULONG_MAX ; td->ts.bw_stat[i].min_val =ULONG_MAX ; + td->ts.iops_stat[i].min_val =ULONG_MAX ; } td->ddir_seq_nr = o->ddir_seq_nr;server.c +1
-0@@ -1474,6 +1474,7 @@ void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs)convert_io_stat (&p.ts.slat_stat[i], &ts->slat_stat[i]);convert_io_stat (&p.ts.lat_stat[i], &ts->lat_stat[i]);convert_io_stat (&p.ts.bw_stat[i], &ts->bw_stat[i]); +convert_io_stat (&p.ts.iops_stat[i], &ts->iops_stat[i]); }
Quoted 4 lines
server.c void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs) · line 1480
Quoted 1 line
server.c +0
-0p.ts.usr_time =cpu_to_le64 (ts->usr_time);You're missing the equivelant client conversion. Also, you need to bump the server version with this change.
Ok. Will fix it.
Andreas
Quoted 13 lines · Andreas Herrmann
Quoted 12 lines · Jens Axboe
Quoted 10 lines · Andreas Herrmann
Hi,
this is a resubmission of patches 1 and 2 to add iops statistics and number of samples for iops and bw stats to normal and json output formats. Patches are rebased on fio-2.21-26-gcf6b7fb4.
I'd like to see similar information added to terse format. Thus I've added patches 3 and 4. First to merge terse functions (reducing code size) and then to add a new terse format 5 where iops stats and number of samples for bw and iops are displayed.
Quoted 7 lines
Quoted 2 lines
Looks good, I like it. Patch #4 needs an explanation of version 5 of the terse format, though. Care to add that?
You mean for the commit message or for the man-page or both? For the latter I think the differences between the different terse versions should be described. (Maybe I missed it but I think that is not in the man-page).
The HOWTO and man page seem to have up to version 3, but doesn't include information that v4 is just v3 + a trim section.
Signature · 1 line
Jens Axboe