@@ -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,13 +458,13 @@ 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 {
+ } else if (!tdata->wait_before_start && !opts.spacing){
tdata->wait_before_start = 0;
}
tdata->duration = opts.duration;
@@ -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);