-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
uint64_t m_rate, t_rate; | ||
uint64_t spent; | ||
uint64_t per_job_spent; | ||
|
||
if (fio_gtod_offload && fio_start_gtod_thread()) | ||
return; | ||
|
@@ -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) { | ||
|
@@ -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]; | ||
|
@@ -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; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
@@ -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); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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", | ||
|
There was a problem hiding this comment.
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.