X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=stat.c;h=3c72a6cd8a140b5fe0b81cb9d65d7dc1329a2dfb;hp=a3fa8363b34dbf0e68e3dce4d1f92ed6f94ead04;hb=1d272416412b0c867224a2b667e6b6124cbc26e8;hpb=78475ac3b9453eff01c34778d70a2aed4aecffe8 diff --git a/stat.c b/stat.c index a3fa8363..3c72a6cd 100644 --- a/stat.c +++ b/stat.c @@ -669,6 +669,8 @@ static void show_thread_status_normal(struct thread_stat *ts, if (!ddir_rw_sum(ts->io_bytes) && !ddir_rw_sum(ts->total_io_u)) return; + + memset(time_buf, 0, sizeof(time_buf)); time(&time_p); os_ctime_r((const time_t *) &time_p, time_buf, sizeof(time_buf)); @@ -1648,7 +1650,8 @@ void __show_run_stats(void) os_ctime_r((const time_t *) &now.tv_sec, time_buf, sizeof(time_buf)); - time_buf[strlen(time_buf) - 1] = '\0'; + if (time_buf[strlen(time_buf) - 1] == '\n') + time_buf[strlen(time_buf) - 1] = '\0'; root = json_create_object(); json_object_add_value_string(root, "fio version", fio_version_string); @@ -2020,7 +2023,7 @@ static void __add_log_sample(struct io_log *iolog, unsigned long val, s = get_sample(iolog, cur_log, cur_log->nr_samples); s->val = val; - s->time = t; + s->time = t + iolog->td->unix_epoch; io_sample_set_ddir(iolog, s, ddir); s->bs = bs; @@ -2234,7 +2237,7 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir 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)); - flist_add(&dst->list, &hw->list.list); + flist_add(&dst->list, &hw->list); __add_log_sample(iolog, (unsigned long)dst, ddir, bs, elapsed, offset); @@ -2457,12 +2460,12 @@ int calc_log_samples(void) next = min(td->o.iops_avg_time, td->o.bw_avg_time); continue; } - if (!per_unit_log(td->bw_log)) { + if (td->bw_log && !per_unit_log(td->bw_log)) { tmp = add_bw_samples(td, &now); if (tmp < next) next = tmp; } - if (!per_unit_log(td->iops_log)) { + if (td->iops_log && !per_unit_log(td->iops_log)) { tmp = add_iops_samples(td, &now); if (tmp < next) next = tmp;