#include "json.h"
#include "lib/getrusage.h"
#include "idletime.h"
+#include "lib/pow2.h"
struct fio_mutex *stat_mutex;
case BLOCK_STATE_TRIM_FAILURE:
return 2;
default:
+ /* Silence compile warning on some BSDs and have a return */
assert(0);
+ return -1;
}
}
struct group_run_stats *rs)
{
struct json_object *root, *tmp;
+ struct jobs_eta *je;
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];
double usr_cpu, sys_cpu;
int i;
+ size_t size;
+
root = json_create_object();
json_object_add_value_string(root, "jobname", ts->name);
json_object_add_value_int(root, "groupid", ts->groupid);
json_object_add_value_int(root, "error", ts->error);
+ /* ETA Info */
+ je = get_jobs_eta(1, &size);
+ json_object_add_value_int(root, "eta", je->eta_sec);
+ json_object_add_value_int(root, "elapsed", je->elapsed_sec);
+
+
add_ddir_status_json(ts, rs, DDIR_READ, root);
add_ddir_status_json(ts, rs, DDIR_WRITE, root);
add_ddir_status_json(ts, rs, DDIR_TRIM, root);
if (!ddir_rw(ddir))
return;
+ td_io_u_lock(td);
+
add_stat_sample(&ts->clat_stat[ddir], usec);
if (td->clat_log)
if (ts->clat_percentiles)
add_clat_percentile_sample(ts, usec, ddir);
+
+ td_io_u_unlock(td);
}
void add_slat_sample(struct thread_data *td, enum fio_ddir ddir,
if (!ddir_rw(ddir))
return;
+ td_io_u_lock(td);
+
add_stat_sample(&ts->slat_stat[ddir], usec);
if (td->slat_log)
add_log_sample(td, td->slat_log, usec, ddir, bs, offset);
+
+ td_io_u_unlock(td);
}
void add_lat_sample(struct thread_data *td, enum fio_ddir ddir,
if (!ddir_rw(ddir))
return;
+ td_io_u_lock(td);
+
add_stat_sample(&ts->lat_stat[ddir], usec);
if (td->lat_log)
add_log_sample(td, td->lat_log, usec, ddir, bs, offset);
+
+ td_io_u_unlock(td);
}
void add_bw_sample(struct thread_data *td, enum fio_ddir ddir, unsigned int bs,
if (spent < td->o.bw_avg_time)
return;
+ td_io_u_lock(td);
+
/*
* Compute both read and write rates for the interval.
*/
}
fio_gettime(&td->bw_sample_time, NULL);
+ td_io_u_unlock(td);
}
void add_iops_sample(struct thread_data *td, enum fio_ddir ddir, unsigned int bs,
if (spent < td->o.iops_avg_time)
return;
+ td_io_u_lock(td);
+
/*
* Compute both read and write rates for the interval.
*/
}
fio_gettime(&td->iops_sample_time, NULL);
+ td_io_u_unlock(td);
}
void stat_init(void)