X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=stat.c;h=731b3036544de363e9db4a82084cce1316203d1e;hp=e6da4218ad9214f2741ca09142ce288c82101911;hb=690089990d051d86b4ef2b6fd5c1972c0dd4897b;hpb=08aae9a0d5f3d24152abd7515984439bbfd3c05d diff --git a/stat.c b/stat.c index e6da4218..731b3036 100644 --- a/stat.c +++ b/stat.c @@ -258,9 +258,6 @@ void disk_util_timer_arm(void) void update_rusage_stat(struct thread_data *td) { - if (!(td->runtime[0] + td->runtime[1])) - return; - getrusage(RUSAGE_SELF, &td->ru_end); td->usr_time += mtime_since(&td->ru_start.ru_utime, &td->ru_end.ru_utime); @@ -362,6 +359,7 @@ static void show_thread_status(struct thread_data *td, struct group_run_stats *rs) { double usr_cpu, sys_cpu; + unsigned long runtime; if (!(td->io_bytes[0] + td->io_bytes[1]) && !td->error) return; @@ -372,8 +370,9 @@ static void show_thread_status(struct thread_data *td, if (td->io_bytes[td->ddir ^ 1]) show_ddir_status(td, rs, td->ddir ^ 1); - if (td->runtime[0] + td->runtime[1]) { - double runt = td->runtime[0] + td->runtime[1]; + runtime = mtime_since(&td->epoch, &td->end_time); + if (runtime) { + double runt = runtime; usr_cpu = (double) td->usr_time * 100 / runt; sys_cpu = (double) td->sys_time * 100 / runt;