Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Per Job Start Delay #1164 #1224

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -2251,9 +2251,11 @@ static bool waitee_running(struct thread_data *me)
static void run_threads(struct sk_out *sk_out)
{
struct thread_data *td;
unsigned int i, todo, nr_running, nr_started;
struct timespec last_finish_time;
unsigned int i, todo, nr_running, nr_started, prev_nr_running;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have kept the unsigned above the struct line to make the diff smaller/more obvious.

uint64_t m_rate, t_rate;
uint64_t spent;
uint64_t per_job_spent;

if (fio_gtod_offload && fio_start_gtod_thread())
return;
Expand Down Expand Up @@ -2294,6 +2296,7 @@ static void run_threads(struct sk_out *sk_out)
todo = thread_number;
nr_running = 0;
nr_started = 0;
prev_nr_running = 0;
m_rate = t_rate = 0;

for_each_td(td, i) {
Expand Down Expand Up @@ -2338,6 +2341,7 @@ static void run_threads(struct sk_out *sk_out)
fio_idle_prof_start();

set_genesis_time();
fio_gettime(&last_finish_time, NULL);

while (todo) {
struct thread_data *map[REAL_MAX_JOBS];
Expand Down Expand Up @@ -2380,6 +2384,13 @@ static void run_threads(struct sk_out *sk_out)
continue;
}

if (td->o.stonewall && td->o.per_job_start_delay) {
per_job_spent = utime_since_now(&last_finish_time);

if (td->o.per_job_start_delay > per_job_spent)
continue;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we only arrive here if we're not waiting for someone else to finish? If so why check for stonewall - surely we can always do the per job delay? I'm curious if we need the last_finish_time... What are your thoughts?

init_disk_util(td);

td->rusage_sem = fio_sem_init(FIO_SEM_LOCKED);
Expand Down Expand Up @@ -2498,7 +2509,12 @@ static void run_threads(struct sk_out *sk_out)
fio_sem_up(td->sem);
}

prev_nr_running = nr_running;
reap_threads(&nr_running, &t_rate, &m_rate);
if (nr_running == prev_nr_running - 1) {
//sequential job has finished get new base time
fio_gettime(&last_finish_time, NULL);
}

if (todo)
do_usleep(100000);
Expand Down
13 changes: 13 additions & 0 deletions options.c
Original file line number Diff line number Diff line change
Expand Up @@ -2744,6 +2744,19 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
.category = FIO_OPT_C_GENERAL,
.group = FIO_OPT_G_RUNTIME,
},
{
.name = "per_job_startdelay",
.lname = "Per Job Start delay",
.type = FIO_OPT_STR_VAL_TIME,
.off1 = offsetof(struct thread_options, per_job_start_delay),
.off2 = offsetof(struct thread_options, per_job_start_delay_high),
.help = "Only start job when this period has passed",
.def = "0",
.is_seconds = 1,
.is_time = 1,
.category = FIO_OPT_C_GENERAL,
.group = FIO_OPT_G_RUNTIME,
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I can specify a per job start delay and a job delay versus the start of all jobs? I feel this would be better as a boolean unless there's a reason why you would specify both together...

{
.name = "runtime",
.lname = "Runtime",
Expand Down
3 changes: 3 additions & 0 deletions thread_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ struct thread_options {
unsigned long long start_delay;
unsigned long long start_delay_orig;
unsigned long long start_delay_high;
unsigned long long per_job_start_delay;
unsigned long long per_job_start_delay_orig;
unsigned long long per_job_start_delay_high;
unsigned long long timeout;
unsigned long long ramp_time;
unsigned int ss_state;
Expand Down