diff options
author | Sanjay Singh Rawat <sanjay.rawat@linaro.org> | 2014-06-23 18:58:18 +0530 |
---|---|---|
committer | Vincent Guittot <vincent.guittot@linaro.org> | 2014-06-24 15:02:20 +0200 |
commit | 4da8d51e49ad1329247d5e47966a80f6f569d79f (patch) | |
tree | f357d576070b8158abdfa2b2a87b59fc794c64f2 | |
parent | 07c79cb69d9d1cc96f09c51aeb564da3834ca79a (diff) |
add delay param in thread parameters
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>
-rw-r--r-- | src/rt-app.c | 4 | ||||
-rw-r--r-- | 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 d361bee..0c8f170 100644 --- a/src/rt-app.c +++ b/src/rt-app.c @@ -481,14 +481,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 50faa56..952d390 100644 --- a/src/rt-app_parse_config.c +++ b/src/rt-app_parse_config.c @@ -391,6 +391,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) { |