Skip to contentSkip to conversation

stat: Modify info for bw and iops stats in normal output

PATCH Superseded Andreas Herrmann 2 participants 4 messages Jun 9, 2017

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover stat: Modify info for bw and iops stats in normal output

Hi,

I'd like to add basic IOPS statistics to fio's output. Sampling is done already but the final calculation and printing is missing.

Also I think it's usefull to know how many samples were collected and used to do the calculations. At least it helped me to understand that log_avg_msec parameter only has impact to metrics for which a log is written (e.g. using write_bw_log, write_lat_log etc.). For the rest the default sampling time is 500 msec, I think.

To make this information available in general, other output formats (at least the terse format) should also be adapted. But before doing that I'd like to know whether adding such info is accepted or rejected.

Thanks,

Andreas

#1 lore raw

PATCH 1/2 stat: Print one-line iops stat

This adds basic iops statistics (likewise to what we already have for bandwidth) in normal fio output, e.g.:

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   | 7 +++++++
 3 files changed, 9 insertions(+)
init.c +1 -0
index 2b7768a..b8e97f0 100644
@@ -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
index 8a5e75d..ff0800c 100644
@@ -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 +7 -0
index fd3ad5a..1e23681 100644
@@ -470,6 +470,10 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
 		log_buf(out, "   bw (%5s/s): min=%5lu, max=%5lu, 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=%5lu, max=%5lu, avg=%5.02f, stdev=%5.02f\n",
+			min, max, mean, dev);
+	}
 }
 
 static int show_lat(double *io_u_lat, int nr, const char **ranges,
@@ -1458,6 +1462,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];
 
@@ -1468,6 +1473,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];
 
@@ -1547,6 +1553,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.7.4
#2 lore raw

PATCH 2/2 stat: Print number of samples in bw and iops stats

In reply to Andreas Herrmann

This adds the actual number of samples used for calculation of bw and iops stats in normal fio output, e.g.

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 | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
stat.c +7 -4
index 1e23681..aa9c8ce 100644
@@ -467,12 +467,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=%5lu, max=%5lu, 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=%5lu, max=%5lu, 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=%5lu, max=%5lu, avg=%5.02f, stdev=%5.02f\n",
-			min, max, mean, dev);
+		log_buf(out, "   iops        : min=%5lu, max=%5lu, "
+			"avg=%5.02f, stdev=%5.02f, samples=%5lu\n",
+			min, max, mean, dev, (&ts->iops_stat[ddir])->samples);
 	}
 }
 
Signature · 1 line
2.7.4
#3 lore raw
In reply to Andreas Herrmann
Quoted 11 lines · Andreas Herrmann

Hi,

I'd like to add basic IOPS statistics to fio's output. Sampling is done already but the final calculation and printing is missing.

Also I think it's usefull to know how many samples were collected and used to do the calculations. At least it helped me to understand that log_avg_msec parameter only has impact to metrics for which a log is written (e.g. using write_bw_log, write_lat_log etc.). For the rest the default sampling time is 500 msec, I think.

Quoted 4 lines

To make this information available in general, other output formats (at least the terse format) should also be adapted. But before doing that I'd like to know whether adding such info is accepted or rejected.

I like it, and my only comment would have been that this should be added to the json format as well. So please go ahead and do that, then I'm fine with it.

Terse is, as usual, more difficult since we can't really break existing parsing scripts. And honestly, I keep pushing people to use json if they want something that is both readable and parseable, so I don't think we need to worry too much about the terse/csv output.

Signature · 1 line
Jens Axboe