return cmp;
}
-static unsigned int calc_clat_percentiles(unsigned int *io_u_plat,
- unsigned long nr, fio_fp64_t *plist,
- unsigned int **output,
- unsigned int *maxv,
- unsigned int *minv)
+unsigned int calc_clat_percentiles(unsigned int *io_u_plat, unsigned long nr,
+ fio_fp64_t *plist, unsigned int **output,
+ unsigned int *maxv, unsigned int *minv)
{
unsigned long sum = 0;
unsigned int len, i, j = 0;
free(ovals);
}
-static int calc_lat(struct io_stat *is, unsigned long *min, unsigned long *max,
- double *mean, double *dev)
+int calc_lat(struct io_stat *is, unsigned long *min, unsigned long *max,
+ double *mean, double *dev)
{
double n = is->samples;
}
}
-#define ts_total_io_u(ts) \
- ((ts)->total_io_u[0] + (ts)->total_io_u[1])
-
-static void stat_calc_dist(unsigned int *map, unsigned long total,
- double *io_u_dist)
+void stat_calc_dist(unsigned int *map, unsigned long total, double *io_u_dist)
{
int i;
}
}
-static void stat_calc_lat_u(struct thread_stat *ts, double *io_u_lat)
+void stat_calc_lat_u(struct thread_stat *ts, double *io_u_lat)
{
stat_calc_lat(ts, io_u_lat, ts->io_u_lat_u, FIO_IO_U_LAT_U_NR);
}
-static void stat_calc_lat_m(struct thread_stat *ts, double *io_u_lat)
+void stat_calc_lat_m(struct thread_stat *ts, double *io_u_lat)
{
stat_calc_lat(ts, io_u_lat, ts->io_u_lat_m, FIO_IO_U_LAT_M_NR);
}
-static int usec_to_msec(unsigned long *min, unsigned long *max, double *mean,
- double *dev)
+static void display_lat(const char *name, unsigned long min, unsigned long max,
+ double mean, double dev)
{
- if (*min > 1000 && *max > 1000 && *mean > 1000.0 && *dev > 1000.0) {
- *min /= 1000;
- *max /= 1000;
- *mean /= 1000.0;
- *dev /= 1000.0;
- return 0;
- }
+ const char *base = "(usec)";
+ char *minp, *maxp;
- return 1;
+ if (!usec_to_msec(&min, &max, &mean, &dev))
+ base = "(msec)";
+
+ minp = num2str(min, 6, 1, 0);
+ maxp = num2str(max, 6, 1, 0);
+
+ log_info(" %s %s: min=%s, max=%s, avg=%5.02f,"
+ " stdev=%5.02f\n", name, base, minp, maxp, mean, dev);
+
+ free(minp);
+ free(maxp);
}
static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
free(bw_p);
free(iops_p);
- if (calc_lat(&ts->slat_stat[ddir], &min, &max, &mean, &dev)) {
- const char *base = "(usec)";
- char *minp, *maxp;
-
- if (!usec_to_msec(&min, &max, &mean, &dev))
- base = "(msec)";
-
- minp = num2str(min, 6, 1, 0);
- maxp = num2str(max, 6, 1, 0);
-
- log_info(" slat %s: min=%s, max=%s, avg=%5.02f,"
- " stdev=%5.02f\n", base, minp, maxp, mean, dev);
-
- free(minp);
- free(maxp);
- }
- if (calc_lat(&ts->clat_stat[ddir], &min, &max, &mean, &dev)) {
- const char *base = "(usec)";
- char *minp, *maxp;
-
- if (!usec_to_msec(&min, &max, &mean, &dev))
- base = "(msec)";
-
- minp = num2str(min, 6, 1, 0);
- maxp = num2str(max, 6, 1, 0);
-
- log_info(" clat %s: min=%s, max=%s, avg=%5.02f,"
- " stdev=%5.02f\n", base, minp, maxp, mean, dev);
-
- free(minp);
- free(maxp);
- }
- if (calc_lat(&ts->lat_stat[ddir], &min, &max, &mean, &dev)) {
- const char *base = "(usec)";
- char *minp, *maxp;
-
- if (!usec_to_msec(&min, &max, &mean, &dev))
- base = "(msec)";
-
- minp = num2str(min, 6, 1, 0);
- maxp = num2str(max, 6, 1, 0);
-
- log_info(" lat %s: min=%s, max=%s, avg=%5.02f,"
- " stdev=%5.02f\n", base, minp, maxp, mean, dev);
+ if (calc_lat(&ts->slat_stat[ddir], &min, &max, &mean, &dev))
+ display_lat("slat", min, max, mean, dev);
+ if (calc_lat(&ts->clat_stat[ddir], &min, &max, &mean, &dev))
+ display_lat("clat", min, max, mean, dev);
+ if (calc_lat(&ts->lat_stat[ddir], &min, &max, &mean, &dev))
+ display_lat(" lat", min, max, mean, dev);
- free(minp);
- free(maxp);
- }
if (ts->clat_percentiles) {
show_clat_percentiles(ts->io_u_plat[ddir],
ts->clat_stat[ddir].samples,
double p_of_agg = 100.0;
const char *bw_str = "KB";
- if (rs->agg[dir]) {
+ if (rs->agg[ddir]) {
p_of_agg = mean * 100 / (double) rs->agg[ddir];
if (p_of_agg > 100.0)
p_of_agg = 100.0;
show_lat(io_u_lat_m, FIO_IO_U_LAT_M_NR, ranges, "msec");
}
-static void show_latencies(double *io_u_lat_u, double *io_u_lat_m)
+static void show_latencies(struct thread_stat *ts)
{
+ double io_u_lat_u[FIO_IO_U_LAT_U_NR];
+ double io_u_lat_m[FIO_IO_U_LAT_M_NR];
+
+ stat_calc_lat_u(ts, io_u_lat_u);
+ stat_calc_lat_m(ts, io_u_lat_m);
+
show_lat_u(io_u_lat_u);
show_lat_m(io_u_lat_m);
}
double usr_cpu, sys_cpu;
unsigned long runtime;
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];
if (!(ts->io_bytes[0] + ts->io_bytes[1]) &&
!(ts->total_io_u[0] + ts->total_io_u[1]))
if (ts->io_bytes[DDIR_WRITE])
show_ddir_status(rs, ts, DDIR_WRITE);
- 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);
+ show_latencies(ts);
runtime = ts->total_run_time;
if (runtime) {
else
memset(ts->description, 0, FIO_JOBNAME_SIZE);
+ /*
+ * If multiple entries in this group, this is
+ * the first member.
+ */
+ ts->thread_number = td->thread_number;
ts->groupid = td->groupid;
/*
if (spent < td->o.bw_avg_time)
return;
- rate = (td->this_io_bytes[ddir] - td->stat_io_bytes[ddir]) *
- 1000 / spent / 1024;
- add_stat_sample(&ts->bw_stat[ddir], rate);
+ /*
+ * Compute both read and write rates for the interval.
+ */
+ for (ddir = DDIR_READ; ddir <= DDIR_WRITE; ddir++) {
+ uint64_t delta;
+
+ delta = td->this_io_bytes[ddir] - td->stat_io_bytes[ddir];
+ if (!delta)
+ continue; /* No entries for interval */
+
+ rate = delta * 1000 / spent / 1024;
+ add_stat_sample(&ts->bw_stat[ddir], rate);
+
+ if (td->bw_log)
+ add_log_sample(td, td->bw_log, rate, ddir, bs);
- if (td->bw_log)
- add_log_sample(td, td->bw_log, rate, ddir, bs);
+ td->stat_io_bytes[ddir] = td->this_io_bytes[ddir];
+ }
fio_gettime(&td->bw_sample_time, NULL);
- td->stat_io_bytes[ddir] = td->this_io_bytes[ddir];
}
void add_iops_sample(struct thread_data *td, enum fio_ddir ddir,
if (spent < td->o.iops_avg_time)
return;
- iops = ((td->this_io_blocks[ddir] - td->stat_io_blocks[ddir]) * 1000) / spent;
+ /*
+ * Compute both read and write rates for the interval.
+ */
+ for (ddir = DDIR_READ; ddir <= DDIR_WRITE; ddir++) {
+ uint64_t delta;
+
+ delta = td->this_io_blocks[ddir] - td->stat_io_blocks[ddir];
+ if (!delta)
+ continue; /* No entries for interval */
+
+ iops = (delta * 1000) / spent;
+ add_stat_sample(&ts->iops_stat[ddir], iops);
- add_stat_sample(&ts->iops_stat[ddir], iops);
+ if (td->iops_log)
+ add_log_sample(td, td->iops_log, iops, ddir, 0);
- if (td->iops_log)
- add_log_sample(td, td->iops_log, iops, ddir, 0);
+ td->stat_io_blocks[ddir] = td->this_io_blocks[ddir];
+ }
fio_gettime(&td->iops_sample_time, NULL);
- td->stat_io_blocks[ddir] = td->this_io_blocks[ddir];
}