X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=stat.c;h=8a242c97430bd0bff2502013af5fd848a2a57881;hb=69b98f11d62cb12482130fac79b8ebf00c0bb139;hp=5bbc056fbeda1b38137002ad37ea5f135c52eeab;hpb=892930839558edf72052e0471714f227c1391132;p=fio.git diff --git a/stat.c b/stat.c index 5bbc056f..8a242c97 100644 --- a/stat.c +++ b/stat.c @@ -18,7 +18,7 @@ #include "helper_thread.h" #include "smalloc.h" -#define LOG_MSEC_SLACK 10 +#define LOG_MSEC_SLACK 1 struct fio_mutex *stat_mutex; @@ -1860,13 +1860,14 @@ void __show_run_stats(void) 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'; @@ -2340,9 +2341,11 @@ static void _add_stat_to_log(struct io_log *iolog, unsigned long elapsed, __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; @@ -2373,7 +2376,7 @@ static long add_log_sample(struct thread_data *td, struct io_log *iolog, 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; @@ -2562,7 +2565,7 @@ static int __add_samples(struct thread_data *td, struct timespec *parent_tv, { unsigned long spent, rate; enum fio_ddir ddir; - unsigned int next, next_log; + unsigned long next, next_log; next_log = avg_time;