-Several minor fixes in the tutorial file -Remove some compilation warnings -Reorder and gather the init of data by feature -Close the log file before exiting the thread body
Signed-off-by: Vincent Guittot vincent.guittot@linaro.org --- doc/tutorial.txt | 8 ++++---- src/rt-app.c | 3 ++- src/rt-app_parse_config.c | 21 +++++++++++---------- 3 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/doc/tutorial.txt b/doc/tutorial.txt index 8341b2e..b2b0971 100644 --- a/doc/tutorial.txt +++ b/doc/tutorial.txt @@ -39,8 +39,8 @@ run indefinitly until all threads kill themselves (as an example if a finite number of loop has been defined in their running pattern) or if a signal is received to stop the use case.
-* calibration : Text or Integer: A text defines the CPU that will be used to -calibrate the ns per loop value. "CPU0" is the default value (see run event +* calibration : String or Integer: A String defines the CPU that will be used +to calibrate the ns per loop value. "CPU0" is the default value (see run event section for details about ns per loop value). A integer skips the calibration step and uses the integer value as ns per loop.
@@ -55,10 +55,10 @@ ensures that your RT thread will not be stalled until a page is moved from swap to RAM. The lock of the page is only possible for non CFS tasks. Default value is False.
-* logdir : Text. Path to store the various log files. The default path is +* logdir : String. Path to store the various log files. The default path is the current directory (./).
-* log_basename : Text. Prefix used for all log files of the use case. +* log_basename : String. Prefix used for all log files of the use case. "rt-app-" is used by default.
* log_size : String or Integer. A Integer defines a fix size in MB of the diff --git a/src/rt-app.c b/src/rt-app.c index 805cc35..f14f228 100644 --- a/src/rt-app.c +++ b/src/rt-app.c @@ -613,7 +613,7 @@ void *thread_body(void *arg) log_ftrace(ft_data.marker_fd, "[%d] exiting", data->ind);
log_notice("[%d] Exiting.", data->ind); -// fclose(data->log_handler); + fclose(data->log_handler);
pthread_exit(NULL); } @@ -767,6 +767,7 @@ int main(int argc, char* argv[]) ""%s-%s-%d.log" u ($5/1000):3 w l" " title "thread [%s] (%s)"", opts.logbasename, opts.threads_data[i].name, + opts.threads_data[i].ind, opts.threads_data[i].name, opts.threads_data[i].sched_policy_descr);
diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c index 98374cd..f4ac5cf 100644 --- a/src/rt-app_parse_config.c +++ b/src/rt-app_parse_config.c @@ -334,7 +334,8 @@ parse_thread_event_data(char *name, struct json_object *obj, { rtapp_resource_t *rdata, *ddata; char unique_name[22]; - const char *ref, *tmp; + const char *ref; + char *tmp; int i;
if (!strncmp(name, "run", strlen("run")) || @@ -434,23 +435,23 @@ parse_thread_event_data(char *name, struct json_object *obj, else data->type = rtapp_sig_and_wait;
- ref = get_string_value_from(obj, "ref", TRUE, "unknown"); - i = get_resource_index(ref, rtapp_wait, opts); + tmp = get_string_value_from(obj, "ref", TRUE, "unknown"); + i = get_resource_index(tmp, rtapp_wait, opts); /* * get_string_value_from allocate the string so with have to free it * once useless */ - free(ref); + free(tmp);
data->res = i;
- ref = get_string_value_from(obj, "mutex", TRUE, "unknown"); - i = get_resource_index(ref, rtapp_mutex, opts); + tmp = get_string_value_from(obj, "mutex", TRUE, "unknown"); + i = get_resource_index(tmp, rtapp_mutex, opts); /* * get_string_value_from allocate the string so with have to free it * once useless */ - free(ref); + free(tmp);
data->dep = i;
@@ -754,14 +755,14 @@ parse_global(struct json_object *global, rtapp_options_t *opts) log_info(PFX " No global section Found: Use default value"); opts->duration = -1; opts->gnuplot = 0; - opts->policy = other; + opts->policy = other; opts->calib_cpu = 0; opts->calib_ns_per_loop = 0; opts->logdir = strdup("./"); - opts->lock_pages = 1; opts->logbasename = strdup("rt-app"); opts->logsize = 0; opts->ftrace = 0; + opts->lock_pages = 1; opts->pi_enabled = 0; opts->io_device = strdup("/dev/null"); opts->mem_buffer_size = DEFAULT_MEM_BUF_SIZE; @@ -844,10 +845,10 @@ parse_global(struct json_object *global, rtapp_options_t *opts) }
opts->logdir = get_string_value_from(global, "logdir", TRUE, "./"); - opts->lock_pages = get_bool_value_from(global, "lock_pages", TRUE, 1); opts->logbasename = get_string_value_from(global, "log_basename", TRUE, "rt-app"); opts->ftrace = get_bool_value_from(global, "ftrace", TRUE, 0); + opts->lock_pages = get_bool_value_from(global, "lock_pages", TRUE, 1); opts->pi_enabled = get_bool_value_from(global, "pi_enabled", TRUE, 0); opts->io_device = get_string_value_from(global, "io_device", TRUE, "/dev/null");