From: Sanjay Singh Rawat sanjay.rawat@linaro.org
Start thread after a certain amount of time,. Add delay option in the json file in microseconds
Signed-off-by: Sanjay Singh Rawat sanjay.rawat@linaro.org Signed-off-by: Vincent Guittot vincent.guittot@linaro.org --- src/rt-app.c | 4 +--- src/rt-app_parse_config.c | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/rt-app.c b/src/rt-app.c index f69977a..107872c 100644 --- a/src/rt-app.c +++ b/src/rt-app.c @@ -519,14 +519,12 @@ int main(int argc, char* argv[]) /* start threads */ 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; diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c index 23e1edd..b45a5be 100644 --- a/src/rt-app_parse_config.c +++ b/src/rt-app_parse_config.c @@ -510,6 +510,9 @@ parse_thread_data(char *name, struct json_object *obj, int idx, data->sched_prio = get_int_value_from(obj, "priority", TRUE, DEFAULT_THREAD_PRIORITY);
+ /* delay */ + data->wait_before_start = get_int_value_from(obj, "delay", TRUE, 0); + /* cpu set */ cpuset_obj = get_in_object(obj, "cpus", TRUE); if (cpuset_obj) {