@@ -262,6 +262,7 @@ void *thread_body(void *arg)
NULL);
log_notice("[%d] Starting...", data->ind);
}
+
/* if we know the duration we can calculate how many periods we will
* do at most, and the log to memory, instead of logging to file.
*/
@@ -457,15 +458,14 @@ int main(int argc, char* argv[])
for (i = 0; i < nthreads; i++)
{
tdata = &opts.threads_data[i];
- if (opts.spacing > 0 ) {
+ if (!tdata->wait_before_start && (opts.spacing > 0)) {
/* start the thread, then it will sleep accordingly
* to its position. We don't sleep here anymore as
* this would mean that
* duration = spacing * nthreads + duration */
tdata->wait_before_start = opts.spacing * (i+1);
- } else {
- tdata->wait_before_start = 0;
}
+
tdata->duration = opts.duration;
tdata->main_app_start = t_start;
tdata->lock_pages = opts.lock_pages;
@@ -389,6 +389,9 @@ parse_thread_data(char *name, struct json_object *obj, int idx,
exit(EXIT_INV_CONFIG);
}
data->deadline = usec_to_timespec(dline);
+
+ /* delay */
+ data->wait_before_start = get_int_value_from(obj, "delay", TRUE, 0);
/* cpu set */
cpuset_obj = get_in_object(obj, "cpus", TRUE);