[PATCH v2 1/5] time: rename in_ramp_time() and ramp_time_over()
Jan Kara <[email protected]> Fri, 19 Dec 2025 14:42:35 +0100
| Newsgroups | org.kernel.vger.fio |
|---|---|
| Message-ID | <[email protected]> |
Rename in_ramp_time() and ramp_time_over() to in_ramp_period() and ramp_period_over() respectively. We will be adding other not time-based methods for determining whether the load is ramping up so the old names would be confusing. Reviewed-by: Damien Le Moal <[email protected]> Signed-off-by: Jan Kara <[email protected]> --- backend.c | 12 ++++++------ eta.c | 6 +++--- fio.h | 2 +- fio_time.h | 4 ++-- io_u.c | 4 ++-- stat.c | 2 +- time.c | 14 +++++++------- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/backend.c b/backend.c index 13c77552a1ed..1e4c4a38369c 100644 --- a/backend.c +++ b/backend.c @@ -298,7 +298,7 @@ static inline void update_ts_cache(struct thread_data *td) static inline bool runtime_exceeded(struct thread_data *td, struct timespec *t) { - if (in_ramp_time(td)) + if (in_ramp_period(td)) return false; if (!td->o.timeout) return false; @@ -1031,7 +1031,7 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done) for (i = 0; i < DDIR_RWDIR_CNT; i++) bytes_done[i] = td->bytes_done[i]; - if (in_ramp_time(td)) + if (in_ramp_period(td)) td_set_runstate(td, TD_RAMP); else td_set_runstate(td, TD_RUNNING); @@ -1162,7 +1162,7 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done) else io_u->end_io = verify_io_u; td_set_runstate(td, TD_VERIFYING); - } else if (in_ramp_time(td)) + } else if (in_ramp_period(td)) td_set_runstate(td, TD_RAMP); else td_set_runstate(td, TD_RUNNING); @@ -1232,7 +1232,7 @@ reap: !td_ioengine_flagged(td, FIO_NOIO)) continue; - if (!in_ramp_time(td) && should_check_rate(td)) { + if (!in_ramp_period(td) && should_check_rate(td)) { if (check_min_rate(td, &comp_time)) { if (exitall_on_terminate || td->o.exitall_error) fio_terminate_threads(td->groupid, td->o.exit_what); @@ -1240,7 +1240,7 @@ reap: break; } } - if (!in_ramp_time(td) && td->o.latency_target) + if (!in_ramp_period(td) && td->o.latency_target) lat_target_check(td); } @@ -2673,7 +2673,7 @@ reap: if (td->runstate != TD_INITIALIZED) continue; - if (in_ramp_time(td)) + if (in_ramp_period(td)) td_set_runstate(td, TD_RAMP); else td_set_runstate(td, TD_RUNNING); diff --git a/eta.c b/eta.c index 16109510067b..947752b9dc17 100644 --- a/eta.c +++ b/eta.c @@ -274,12 +274,12 @@ static unsigned long thread_eta(struct thread_data *td) uint64_t ramp_time = td->o.ramp_time; t_eta = __timeout + start_delay; - if (!td->ramp_time_over) { + if (!td->ramp_period_over) { t_eta += ramp_time; } t_eta /= 1000000ULL; - if ((td->runstate == TD_RAMP) && in_ramp_time(td)) { + if ((td->runstate == TD_RAMP) && in_ramp_period(td)) { unsigned long ramp_left; ramp_left = mtime_since_now(&td->epoch); @@ -522,7 +522,7 @@ static bool calc_thread_status(struct jobs_eta *je, int force) any_td_in_ramp = false; for_each_td(td) { - any_td_in_ramp |= in_ramp_time(td); + any_td_in_ramp |= in_ramp_period(td); } end_for_each(); if (write_bw_log && rate_time > bw_avg_time && !any_td_in_ramp) { calc_rate(unified_rw_rep, rate_time, io_bytes, rate_io_bytes, diff --git a/fio.h b/fio.h index 037678d182b8..87c20803a929 100644 --- a/fio.h +++ b/fio.h @@ -417,7 +417,7 @@ struct thread_data { struct timespec terminate_time; unsigned int ts_cache_nr; unsigned int ts_cache_mask; - bool ramp_time_over; + bool ramp_period_over; /* * Time since last latency_window was started diff --git a/fio_time.h b/fio_time.h index 969ad68d5b9c..30de7aca4fb1 100644 --- a/fio_time.h +++ b/fio_time.h @@ -27,8 +27,8 @@ extern uint64_t usec_spin(unsigned int); extern uint64_t usec_sleep(struct thread_data *, unsigned long); extern void fill_start_time(struct timespec *); extern void set_genesis_time(void); -extern bool ramp_time_over(struct thread_data *); -extern bool in_ramp_time(struct thread_data *); +extern bool ramp_period_over(struct thread_data *); +extern bool in_ramp_period(struct thread_data *); extern void fio_time_init(void); extern void timespec_add_msec(struct timespec *, unsigned int); extern void set_epoch_time(struct thread_data *, clockid_t, clockid_t); diff --git a/io_u.c b/io_u.c index ec3f668cae49..be0a0555098f 100644 --- a/io_u.c +++ b/io_u.c @@ -2106,7 +2106,7 @@ static void file_log_write_comp(const struct thread_data *td, struct fio_file *f static bool should_account(struct thread_data *td) { - return ramp_time_over(td) && (td->runstate == TD_RUNNING || + return ramp_period_over(td) && (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING); } @@ -2333,7 +2333,7 @@ int io_u_queued_complete(struct thread_data *td, int min_evts) */ void io_u_queued(struct thread_data *td, struct io_u *io_u) { - if (!td->o.disable_slat && ramp_time_over(td) && td->o.stats) { + if (!td->o.disable_slat && ramp_period_over(td) && td->o.stats) { if (td->parent) td = td->parent; add_slat_sample(td, io_u); diff --git a/stat.c b/stat.c index a67d35514d1a..c7c0f2f4a3ef 100644 --- a/stat.c +++ b/stat.c @@ -3626,7 +3626,7 @@ static int add_iops_samples(struct thread_data *td, struct timespec *t) static bool td_in_logging_state(struct thread_data *td) { - if (in_ramp_time(td)) + if (in_ramp_period(td)) return false; switch(td->runstate) { diff --git a/time.c b/time.c index 7f85c8de3bcb..9625e8cd92af 100644 --- a/time.c +++ b/time.c @@ -110,31 +110,31 @@ uint64_t utime_since_genesis(void) return utime_since_now(&genesis); } -bool in_ramp_time(struct thread_data *td) +bool in_ramp_period(struct thread_data *td) { - return td->o.ramp_time && !td->ramp_time_over; + return td->o.ramp_time && !td->ramp_period_over; } static bool parent_update_ramp(struct thread_data *td) { struct thread_data *parent = td->parent; - if (!parent || parent->ramp_time_over) + if (!parent || parent->ramp_period_over) return false; reset_all_stats(parent); - parent->ramp_time_over = true; + parent->ramp_period_over = true; td_set_runstate(parent, TD_RAMP); return true; } -bool ramp_time_over(struct thread_data *td) +bool ramp_period_over(struct thread_data *td) { - if (!td->o.ramp_time || td->ramp_time_over) + if (!td->o.ramp_time || td->ramp_period_over) return true; if (utime_since_now(&td->epoch) >= td->o.ramp_time) { - td->ramp_time_over = true; + td->ramp_period_over = true; reset_all_stats(td); reset_io_stats(td); td_set_runstate(td, TD_RAMP); -- 2.51.0