X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=stat.c;h=326b1f763460827f05334fda03453ea39d398f27;hp=a79c7ef29da473567debc712f3c6909b077f7a13;hb=d708ac5e21c97a92c9c7b6b7593d9f2b0d7c9d3f;hpb=743ed83a203800ba3a7d89fc76f3424d693db06c diff --git a/stat.c b/stat.c index a79c7ef2..326b1f76 100644 --- a/stat.c +++ b/stat.c @@ -157,6 +157,8 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts, char *io_p, *bw_p, *iops_p; int i2p; + assert(ddir_rw(ddir)); + if (!ts->runtime[ddir]) return; @@ -349,9 +351,11 @@ static void show_thread_status(struct thread_stat *ts, io_u_dist[1], io_u_dist[2], io_u_dist[3], io_u_dist[4], io_u_dist[5], io_u_dist[6]); - log_info(" issued r/w: total=%lu/%lu, short=%lu/%lu\n", + log_info(" issued r/w/d: total=%lu/%lu/%lu, short=%lu/%lu/%lu\n", ts->total_io_u[0], ts->total_io_u[1], - ts->short_io_u[0], ts->short_io_u[1]); + ts->total_io_u[2], + ts->short_io_u[0], ts->short_io_u[1], + ts->short_io_u[2]); stat_calc_lat_u(ts, io_u_lat_u); stat_calc_lat_m(ts, io_u_lat_m); show_latencies(io_u_lat_u, io_u_lat_m); @@ -370,6 +374,8 @@ static void show_ddir_status_terse(struct thread_stat *ts, unsigned long long bw; double mean, dev; + assert(ddir_rw(ddir)); + bw = 0; if (ts->runtime[ddir]) bw = ts->io_bytes[ddir] / ts->runtime[ddir]; @@ -401,6 +407,7 @@ static void show_ddir_status_terse(struct thread_stat *ts, log_info(";%lu;%lu;%f%%;%f;%f", 0UL, 0UL, 0.0, 0.0, 0.0); } +#define FIO_TERSE_VERSION "2" static void show_thread_status_terse(struct thread_stat *ts, struct group_run_stats *rs) @@ -411,7 +418,8 @@ static void show_thread_status_terse(struct thread_stat *ts, double usr_cpu, sys_cpu; int i; - log_info("%s;%d;%d", ts->name, ts->groupid, ts->error); + log_info("%s;%s;%d;%d", FIO_TERSE_VERSION, ts->name, ts->groupid, + ts->error); show_ddir_status_terse(ts, rs, 0); show_ddir_status_terse(ts, rs, 1); @@ -609,7 +617,7 @@ void show_run_stats(void) ts->io_u_lat_m[k] += td->ts.io_u_lat_m[k]; - for (k = 0; k <= DDIR_WRITE; k++) { + for (k = 0; k <= 2; k++) { ts->total_io_u[k] += td->ts.total_io_u[k]; ts->short_io_u[k] += td->ts.short_io_u[k]; } @@ -733,13 +741,20 @@ static void add_log_sample(struct thread_data *td, struct io_log *iolog, unsigned long val, enum fio_ddir ddir, unsigned int bs) { + if (!ddir_rw(ddir)) + return; + __add_log_sample(iolog, val, ddir, bs, mtime_since_now(&td->epoch)); } void add_agg_sample(unsigned long val, enum fio_ddir ddir, unsigned int bs) { - struct io_log *iolog = agg_io_log[ddir]; + struct io_log *iolog; + if (!ddir_rw(ddir)) + return; + + iolog = agg_io_log[ddir]; __add_log_sample(iolog, val, ddir, bs, mtime_since_genesis()); } @@ -748,6 +763,9 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir ddir, { struct thread_stat *ts = &td->ts; + if (!ddir_rw(ddir)) + return; + add_stat_sample(&ts->clat_stat[ddir], usec); if (ts->clat_log) @@ -759,6 +777,9 @@ void add_slat_sample(struct thread_data *td, enum fio_ddir ddir, { struct thread_stat *ts = &td->ts; + if (!ddir_rw(ddir)) + return; + add_stat_sample(&ts->slat_stat[ddir], usec); if (ts->slat_log) @@ -770,6 +791,9 @@ void add_lat_sample(struct thread_data *td, enum fio_ddir ddir, { struct thread_stat *ts = &td->ts; + if (!ddir_rw(ddir)) + return; + add_stat_sample(&ts->lat_stat[ddir], usec); if (ts->lat_log) @@ -780,9 +804,12 @@ void add_bw_sample(struct thread_data *td, enum fio_ddir ddir, unsigned int bs, struct timeval *t) { struct thread_stat *ts = &td->ts; - unsigned long spent = mtime_since(&ts->stat_sample_time[ddir], t); - unsigned long rate; + unsigned long spent, rate; + + if (!ddir_rw(ddir)) + return; + spent = mtime_since(&ts->stat_sample_time[ddir], t); if (spent < td->o.bw_avg_time) return;