log_buf(out, "\n");
}
-static void json_add_job_opts(struct json_object *root, const char *name,
- struct flist_head *opt_list, bool num_jobs)
+void json_add_job_opts(struct json_object *root, const char *name,
+ struct flist_head *opt_list, bool num_jobs)
{
struct json_object *dir_object;
struct flist_head *entry;
struct json_object *show_thread_status(struct thread_stat *ts,
struct group_run_stats *rs,
+ struct flist_head *opt_list,
struct buf_output *out)
{
struct json_object *ret = NULL;
if (output_format & FIO_OUTPUT_TERSE)
show_thread_status_terse(ts, rs, out);
if (output_format & FIO_OUTPUT_JSON)
- ret = show_thread_status_json(ts, rs, NULL);
+ ret = show_thread_status_json(ts, rs, opt_list);
if (output_format & FIO_OUTPUT_NORMAL)
show_thread_status_normal(ts, rs, out);
json_object_add_value_array(root, "jobs", array);
}
+ if (is_backend)
+ fio_server_send_job_options(&get_global_options()->opt_list, -1U);
+
for (i = 0; i < nr_ts; i++) {
ts = &threadstats[i];
rs = &runstats[ts->groupid];
- if (is_backend)
+ if (is_backend) {
+ fio_server_send_job_options(opt_lists[i], i);
fio_server_send_ts(ts, rs);
- else {
+ } else {
if (output_format & FIO_OUTPUT_TERSE)
show_thread_status_terse(ts, rs, &output[__FIO_OUTPUT_TERSE]);
if (output_format & FIO_OUTPUT_JSON) {
fio_gettime(&tv, NULL);
for_each_td(td, i) {
- rt[i] = mtime_since(&td->start, &tv);
- if (td_read(td) && td->io_bytes[DDIR_READ])
- td->ts.runtime[DDIR_READ] += rt[i];
- if (td_write(td) && td->io_bytes[DDIR_WRITE])
- td->ts.runtime[DDIR_WRITE] += rt[i];
- if (td_trim(td) && td->io_bytes[DDIR_TRIM])
- td->ts.runtime[DDIR_TRIM] += rt[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];
td->ts.total_run_time = mtime_since(&td->epoch, &tv);
+
+ rt[i] = mtime_since(&td->start, &tv);
+ if (td_read(td) && td->ts.io_bytes[DDIR_READ])
+ td->ts.runtime[DDIR_READ] += rt[i];
+ if (td_write(td) && td->ts.io_bytes[DDIR_WRITE])
+ td->ts.runtime[DDIR_WRITE] += rt[i];
+ if (td_trim(td) && td->ts.io_bytes[DDIR_TRIM])
+ td->ts.runtime[DDIR_TRIM] += rt[i];
}
for_each_td(td, i) {
__show_run_stats();
for_each_td(td, i) {
- if (td_read(td) && td->io_bytes[DDIR_READ])
+ if (td_read(td) && td->ts.io_bytes[DDIR_READ])
td->ts.runtime[DDIR_READ] -= rt[i];
- if (td_write(td) && td->io_bytes[DDIR_WRITE])
+ if (td_write(td) && td->ts.io_bytes[DDIR_WRITE])
td->ts.runtime[DDIR_WRITE] -= rt[i];
- if (td_trim(td) && td->io_bytes[DDIR_TRIM])
+ if (td_trim(td) && td->ts.io_bytes[DDIR_TRIM])
td->ts.runtime[DDIR_TRIM] -= rt[i];
}
}
}
-static void _add_stat_to_log(struct io_log *iolog, unsigned long elapsed)
+static void __add_stat_to_log(struct io_log *iolog, enum fio_ddir ddir,
+ unsigned long elapsed, bool log_max)
{
/*
* Note an entry in the log. Use the mean from the logged samples,
* making sure to properly round up. Only write a log entry if we
* had actual samples done.
*/
- if (iolog->avg_window[DDIR_READ].samples) {
- unsigned long mr;
+ if (iolog->avg_window[ddir].samples) {
+ unsigned long val;
- mr = iolog->avg_window[DDIR_READ].mean.u.f + 0.50;
- __add_log_sample(iolog, mr, DDIR_READ, 0, elapsed, 0);
- }
- if (iolog->avg_window[DDIR_WRITE].samples) {
- unsigned long mw;
+ if (log_max)
+ val = iolog->avg_window[ddir].max_val;
+ else
+ val = iolog->avg_window[ddir].mean.u.f + 0.50;
- mw = iolog->avg_window[DDIR_WRITE].mean.u.f + 0.50;
- __add_log_sample(iolog, mw, DDIR_WRITE, 0, elapsed, 0);
+ __add_log_sample(iolog, val, ddir, 0, elapsed, 0);
}
- if (iolog->avg_window[DDIR_TRIM].samples) {
- unsigned long mw;
- mw = iolog->avg_window[DDIR_TRIM].mean.u.f + 0.50;
- __add_log_sample(iolog, mw, DDIR_TRIM, 0, elapsed, 0);
- }
+ reset_io_stat(&iolog->avg_window[ddir]);
+}
+
+static void _add_stat_to_log(struct io_log *iolog, unsigned long elapsed,
+ bool log_max)
+{
+ int ddir;
- reset_io_stat(&iolog->avg_window[DDIR_READ]);
- reset_io_stat(&iolog->avg_window[DDIR_WRITE]);
- reset_io_stat(&iolog->avg_window[DDIR_TRIM]);
+ for (ddir = 0; ddir < DDIR_RWDIR_CNT; ddir++)
+ __add_stat_to_log(iolog, ddir, elapsed, log_max);
}
static void add_log_sample(struct thread_data *td, struct io_log *iolog,
if (this_window < iolog->avg_msec)
return;
- _add_stat_to_log(iolog, elapsed);
+ _add_stat_to_log(iolog, elapsed, td->o.log_max != 0);
iolog->avg_last = elapsed;
}
elapsed = mtime_since_now(&td->epoch);
if (td->clat_log)
- _add_stat_to_log(td->clat_log, elapsed);
+ _add_stat_to_log(td->clat_log, elapsed, td->o.log_max != 0);
if (td->slat_log)
- _add_stat_to_log(td->slat_log, elapsed);
+ _add_stat_to_log(td->slat_log, elapsed, td->o.log_max != 0);
if (td->lat_log)
- _add_stat_to_log(td->lat_log, elapsed);
+ _add_stat_to_log(td->lat_log, elapsed, td->o.log_max != 0);
if (td->bw_log)
- _add_stat_to_log(td->bw_log, elapsed);
+ _add_stat_to_log(td->bw_log, elapsed, td->o.log_max != 0);
if (td->iops_log)
- _add_stat_to_log(td->iops_log, elapsed);
+ _add_stat_to_log(td->iops_log, elapsed, td->o.log_max != 0);
}
void add_agg_sample(unsigned long val, enum fio_ddir ddir, unsigned int bs)