X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=steadystate.c;h=bd2f70dd3af1b6084994b2409ef6d7f862e2aac4;hp=2017ca67a896fbaba39e7b9e8a7c24369003d5a1;hb=e8aaa77654d7b9d995b53837903d19b5364c9ba4;hpb=af7fb4aa2835b82847701237783c9ebe8ec8239a diff --git a/steadystate.c b/steadystate.c index 2017ca67..bd2f70dd 100644 --- a/steadystate.c +++ b/steadystate.c @@ -2,7 +2,6 @@ #include "fio.h" #include "steadystate.h" -#include "helper_thread.h" bool steadystate_enabled = false; @@ -209,6 +208,7 @@ void steadystate_check(void) prev_groupid = -1; for_each_td(td, i) { + const bool needs_lock = td_async_processing(td); struct steadystate_data *ss = &td->ss; if (!ss->dur || td->runstate <= TD_SETTING_UP || @@ -236,12 +236,16 @@ void steadystate_check(void) ss->state |= FIO_SS_RAMP_OVER; } - td_io_u_lock(td); + if (needs_lock) + __td_io_u_lock(td); + for (ddir = 0; ddir < DDIR_RWDIR_CNT; ddir++) { td_iops += td->io_blocks[ddir]; td_bytes += td->io_bytes[ddir]; } - td_io_u_unlock(td); + + if (needs_lock) + __td_io_u_unlock(td); rate_time = mtime_since(&ss->prev_time, &now); memcpy(&ss->prev_time, &now, sizeof(now)); @@ -351,6 +355,9 @@ uint64_t steadystate_bw_mean(struct thread_stat *ts) int i; uint64_t sum; + if (!ts->ss_dur) + return 0; + for (i = 0, sum = 0; i < ts->ss_dur; i++) sum += ts->ss_bw_data[i]; @@ -362,6 +369,9 @@ uint64_t steadystate_iops_mean(struct thread_stat *ts) int i; uint64_t sum; + if (!ts->ss_dur) + return 0; + for (i = 0, sum = 0; i < ts->ss_dur; i++) sum += ts->ss_iops_data[i];