free(maxp);
}
+static double convert_agg_kbytes_percent(struct group_run_stats *rs, int ddir, int mean)
+{
+ double p_of_agg = 100.0;
+ if (rs && rs->agg[ddir] > 1024) {
+ p_of_agg = mean * 100 / (double) (rs->agg[ddir] / 1024.0);
+
+ if (p_of_agg > 100.0)
+ p_of_agg = 100.0;
+ }
+ return p_of_agg;
+}
+
static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
int ddir, struct buf_output *out)
{
else
bw_str = "kB";
- if (rs->agg[ddir]) {
- p_of_agg = mean * 100 / (double) (rs->agg[ddir] / 1024);
- if (p_of_agg > 100.0)
- p_of_agg = 100.0;
- }
+ p_of_agg = convert_agg_kbytes_percent(rs, ddir, mean);
if (rs->unit_base == 1) {
min *= 8.0;
if (strlen(ts->description))
log_buf(out, " Description : [%s]\n", ts->description);
- if (ts->io_bytes[DDIR_READ])
- show_ddir_status(rs, ts, DDIR_READ, out);
- if (ts->io_bytes[DDIR_WRITE])
- show_ddir_status(rs, ts, DDIR_WRITE, out);
- if (ts->io_bytes[DDIR_TRIM])
- show_ddir_status(rs, ts, DDIR_TRIM, out);
+ for_each_rw_ddir(ddir) {
+ if (ts->io_bytes[ddir])
+ show_ddir_status(rs, ts, ddir, out);
+ }
show_latencies(ts, out);
}
if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) {
- if (rs->agg[ddir]) {
- p_of_agg = mean * 100 / (double) (rs->agg[ddir] / 1024);
- if (p_of_agg > 100.0)
- p_of_agg = 100.0;
- }
+ p_of_agg = convert_agg_kbytes_percent(rs, ddir, mean);
} else {
min = max = 0;
p_of_agg = mean = dev = 0.0;
json_object_add_value_object(root, name, dir_object);
flist_for_each(entry, opt_list) {
- const char *pos = "";
-
p = flist_entry(entry, struct print_option, list);
- if (p->value)
- pos = p->value;
- json_object_add_value_string(dir_object, p->name, pos);
+ json_object_add_value_string(dir_object, p->name, p->value);
}
}
free(opt_lists);
}
-void __show_running_run_stats(void)
+int __show_running_run_stats(void)
{
struct thread_data *td;
unsigned long long *rt;
for_each_td(td, i) {
td->update_rusage = 1;
- td->ts.io_bytes[DDIR_READ] = td->io_bytes[DDIR_READ];
- td->ts.io_bytes[DDIR_WRITE] = td->io_bytes[DDIR_WRITE];
- td->ts.io_bytes[DDIR_TRIM] = td->io_bytes[DDIR_TRIM];
+ for_each_rw_ddir(ddir) {
+ td->ts.io_bytes[ddir] = td->io_bytes[ddir];
+ }
td->ts.total_run_time = mtime_since(&td->epoch, &ts);
rt[i] = mtime_since(&td->start, &ts);
free(rt);
fio_sem_up(stat_sem);
+
+ return 0;
}
static bool status_file_disabled;
assert(idx < td->ts.nr_block_infos);
return info;
}
+