X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=time.c;h=cd0e2a89144b59a565d88fab6192dda951a8ff2b;hp=07984190d67a914173e1980f0ed0461b45ea5ee8;hb=3a3e5c6e7606e727df1788a73d04db56d77ba00d;hpb=a16f04b96d6328d87fb04d6c2c1a9936b2e274d8 diff --git a/time.c b/time.c index 07984190..cd0e2a89 100644 --- a/time.c +++ b/time.c @@ -57,6 +57,13 @@ uint64_t usec_sleep(struct thread_data *td, unsigned long usec) if (ts >= 1000000) { req.tv_sec = ts / 1000000; ts -= 1000000 * req.tv_sec; + /* + * Limit sleep to ~1 second at most, otherwise we + * don't notice then someone signaled the job to + * exit manually. + */ + if (req.tv_sec > 1) + req.tv_sec = 1; } else req.tv_sec = 0; @@ -97,16 +104,17 @@ bool in_ramp_time(struct thread_data *td) return td->o.ramp_time && !td->ramp_time_over; } -static void parent_update_ramp(struct thread_data *td) +static bool parent_update_ramp(struct thread_data *td) { struct thread_data *parent = td->parent; if (!parent || parent->ramp_time_over) - return; + return false; reset_all_stats(parent); - parent->ramp_time_over = 1; + parent->ramp_time_over = true; td_set_runstate(parent, TD_RAMP); + return true; } bool ramp_time_over(struct thread_data *td) @@ -115,10 +123,19 @@ bool ramp_time_over(struct thread_data *td) return true; if (utime_since_now(&td->epoch) >= td->o.ramp_time) { - td->ramp_time_over = 1; + td->ramp_time_over = true; reset_all_stats(td); + reset_io_stats(td); td_set_runstate(td, TD_RAMP); - parent_update_ramp(td); + + /* + * If we have a parent, the parent isn't doing IO. Hence + * the parent never enters do_io(), which will switch us + * from RAMP -> RUNNING. Do this manually here. + */ + if (parent_update_ramp(td)) + td_set_runstate(td, TD_RUNNING); + return true; }