#include "helper_thread.h"
#include "smalloc.h"
-#define LOG_MSEC_SLACK 10
+#define LOG_MSEC_SLACK 1
struct fio_mutex *stat_mutex;
return cmp;
}
-unsigned int calc_clat_percentiles(unsigned int *io_u_plat, unsigned long long nr,
+unsigned int calc_clat_percentiles(uint64_t *io_u_plat, unsigned long long nr,
fio_fp64_t *plist, unsigned long long **output,
unsigned long long *maxv, unsigned long long *minv)
{
/*
* Find and display the p-th percentile of clat
*/
-static void show_clat_percentiles(unsigned int *io_u_plat, unsigned long long nr,
+static void show_clat_percentiles(uint64_t *io_u_plat, unsigned long long nr,
fio_fp64_t *plist, unsigned int precision,
const char *pre, struct buf_output *out)
{
}
}
-void stat_calc_dist(unsigned int *map, unsigned long total, double *io_u_dist)
+void stat_calc_dist(uint64_t *map, unsigned long total, double *io_u_dist)
{
int i;
}
static void stat_calc_lat(struct thread_stat *ts, double *dst,
- unsigned int *src, int nr)
+ uint64_t *src, int nr)
{
unsigned long total = ddir_rw_sum(ts->total_io_u);
int i;
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_buf(out, " issued rwt: total=%llu,%llu,%llu,"
- " short=%llu,%llu,%llu,"
- " dropped=%llu,%llu,%llu\n",
+ log_buf(out, " issued rwts: total=%llu,%llu,%llu,%llu"
+ " short=%llu,%llu,%llu,0"
+ " dropped=%llu,%llu,%llu,0\n",
(unsigned long long) ts->total_io_u[0],
(unsigned long long) ts->total_io_u[1],
(unsigned long long) ts->total_io_u[2],
+ (unsigned long long) ts->total_io_u[3],
(unsigned long long) ts->short_io_u[0],
(unsigned long long) ts->short_io_u[1],
(unsigned long long) ts->short_io_u[2],
tmp_object = json_create_object();
json_object_add_value_object(dir_object, "lat_ns", tmp_object);
+ json_object_add_value_int(dir_object, "total_ios", ts->total_io_u[DDIR_SYNC]);
json_object_add_value_int(tmp_object, "min", min);
json_object_add_value_int(tmp_object, "max", max);
json_object_add_value_float(tmp_object, "mean", mean);
}
static void json_add_job_opts(struct json_object *root, const char *name,
- struct flist_head *opt_list, bool num_jobs)
+ struct flist_head *opt_list)
{
struct json_object *dir_object;
struct flist_head *entry;
const char *pos = "";
p = flist_entry(entry, struct print_option, list);
- if (!num_jobs && !strcmp(p->name, "numjobs"))
- continue;
if (p->value)
pos = p->value;
json_object_add_value_string(dir_object, p->name, pos);
}
if (opt_list)
- json_add_job_opts(root, "job options", opt_list, true);
+ json_add_job_opts(root, "job options", opt_list);
add_ddir_status_json(ts, rs, DDIR_READ, root);
add_ddir_status_json(ts, rs, DDIR_WRITE, root);
}
}
+ dst->total_io_u[DDIR_SYNC] += src->total_io_u[DDIR_SYNC];
+
for (k = 0; k < DDIR_RWDIR_CNT; k++) {
int m;
ts->bw_stat[j].min_val = -1UL;
ts->iops_stat[j].min_val = -1UL;
}
+ ts->sync_stat.min_val = -1UL;
ts->groupid = -1;
}
char time_buf[32];
struct timeval now;
unsigned long long ms_since_epoch;
+ time_t tv_sec;
gettimeofday(&now, NULL);
ms_since_epoch = (unsigned long long)(now.tv_sec) * 1000 +
(unsigned long long)(now.tv_usec) / 1000;
- os_ctime_r((const time_t *) &now.tv_sec, time_buf,
- sizeof(time_buf));
+ tv_sec = now.tv_sec;
+ os_ctime_r(&tv_sec, time_buf, sizeof(time_buf));
if (time_buf[strlen(time_buf) - 1] == '\n')
time_buf[strlen(time_buf) - 1] = '\0';
json_object_add_value_int(root, "timestamp_ms", ms_since_epoch);
json_object_add_value_string(root, "time", time_buf);
global = get_global_options();
- json_add_job_opts(root, "global options", &global->opt_list, false);
+ json_add_job_opts(root, "global options", &global->opt_list);
array = json_create_array();
json_object_add_value_array(root, "jobs", array);
}
}
}
+ ts->total_io_u[DDIR_SYNC] = 0;
+
for (i = 0; i < FIO_IO_U_MAP_NR; i++) {
ts->io_u_map[i] = 0;
ts->io_u_submit[i] = 0;
__add_stat_to_log(iolog, ddir, elapsed, log_max);
}
-static long add_log_sample(struct thread_data *td, struct io_log *iolog,
- union io_sample_data data, enum fio_ddir ddir,
- unsigned int bs, uint64_t offset)
+static unsigned long add_log_sample(struct thread_data *td,
+ struct io_log *iolog,
+ union io_sample_data data,
+ enum fio_ddir ddir, unsigned int bs,
+ uint64_t offset)
{
unsigned long elapsed, this_window;
if (elapsed < iolog->avg_last[ddir])
return iolog->avg_last[ddir] - elapsed;
else if (this_window < iolog->avg_msec) {
- int diff = iolog->avg_msec - this_window;
+ unsigned long diff = iolog->avg_msec - this_window;
if (inline_log(iolog) || diff > LOG_MSEC_SLACK)
return diff;
this_window = elapsed - hw->hist_last;
if (this_window >= iolog->hist_msec) {
- unsigned int *io_u_plat;
+ uint64_t *io_u_plat;
struct io_u_plat_entry *dst;
/*
* located in iolog.c after printing this sample to the
* log file.
*/
- io_u_plat = (unsigned int *) td->ts.io_u_plat[ddir];
+ io_u_plat = (uint64_t *) td->ts.io_u_plat[ddir];
dst = malloc(sizeof(struct io_u_plat_entry));
memcpy(&(dst->io_u_plat), io_u_plat,
FIO_IO_U_PLAT_NR * sizeof(unsigned int));
{
unsigned long spent, rate;
enum fio_ddir ddir;
- unsigned int next, next_log;
+ unsigned long next, next_log;
next_log = avg_time;