diff options
author | Vincent Guittot <vincent.guittot@linaro.org> | 2014-09-10 09:38:09 +0200 |
---|---|---|
committer | Vincent Guittot <vincent.guittot@linaro.org> | 2014-09-10 09:41:55 +0200 |
commit | de7d2cf2b1b287699506ff631d9c91882d719f5d (patch) | |
tree | 5cf064138378f08d6f3f82198b78b5bc822321a7 /src | |
parent | fb8bce65d9cb5a02e35a0160a574b23bda5f929a (diff) |
add instance feature
Instead of copy//pasting a task, you can know add the instance parameter
which will be used to duplicated a task
Diffstat (limited to 'src')
-rw-r--r-- | src/rt-app_parse_config.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c index a89bb88..a1f212b 100644 --- a/src/rt-app_parse_config.c +++ b/src/rt-app_parse_config.c @@ -549,15 +549,22 @@ parse_tasks(struct json_object *tasks, rtapp_options_t *opts) /* used in the foreach macro */ struct lh_entry *entry; char *key; struct json_object *val; int idx; - log_info(PFX "Parsing threads section"); + int i, instance; + + log_info(PFX "Parsing tasks section"); opts->nthreads = 0; foreach(tasks, entry, key, val, idx) { - opts->nthreads++; + instance = get_int_value_from(val, "instance", TRUE, 1); + opts->nthreads += instance; } - log_info(PFX "Found %d threads", opts->nthreads); + + log_info(PFX "Found %d tasks", opts->nthreads); opts->threads_data = malloc(sizeof(thread_data_t) * opts->nthreads); + i = instance = 0; foreach (tasks, entry, key, val, idx) { - parse_thread_data(key, val, idx, &opts->threads_data[idx], opts); + instance += get_int_value_from(val, "instance", TRUE, 1); + for (; i < instance; i++) + parse_thread_data(key, val, i, &opts->threads_data[i], opts); } } |