diff options
author | Juri Lelli <juri.lelli@arm.com> | 2016-11-17 11:31:46 +0000 |
---|---|---|
committer | Juri Lelli <juri.lelli@arm.com> | 2016-11-25 08:21:17 +0000 |
commit | 9415c2e4a5b3f18655577a3fa789d39b2c2d6d38 (patch) | |
tree | 0c9cc9189065e5da4759cf004dc95f987c7ac85e | |
parent | f29ac171d487e33456668fcd5c9c9d77f5c61ca1 (diff) |
rt-app: let caller manage tracing start/stop
Don't explicitly manage start/stop of tracing, but assume that the
caller does that before starting rt-app. This helps if the caller wants
more padding before/after an rt-app execution.
In case tracing is not started and ftrace is enable in the json
configuration, rt-app will fail to start.
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
Acked-by: Vincent Guittot <vincent.guittot@linaro.org>
-rw-r--r-- | src/rt-app.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/rt-app.c b/src/rt-app.c index 0d24c8d..e3aece8 100644 --- a/src/rt-app.c +++ b/src/rt-app.c @@ -40,7 +40,6 @@ static pthread_barrier_t threads_barrier; static ftrace_data_t ft_data = { .debugfs = "/sys/kernel/debug", - .trace_fd = -1, .marker_fd = -1, }; @@ -431,10 +430,8 @@ shutdown(int sig) } if (opts.ftrace) { - log_notice("stopping ftrace"); log_ftrace(ft_data.marker_fd, "main ends\n"); - log_ftrace(ft_data.trace_fd, "0"); - close(ft_data.trace_fd); + log_notice("deconfiguring ftrace"); close(ft_data.marker_fd); } @@ -732,21 +729,14 @@ int main(int argc, char* argv[]) log_notice("configuring ftrace"); strcpy(tmp, ft_data.debugfs); strcat(tmp, "/tracing/tracing_on"); - ft_data.trace_fd = open(tmp, O_WRONLY); - if (ft_data.trace_fd < 0) { - log_error("Cannot open trace_fd file %s", tmp); - exit(EXIT_FAILURE); - } - strcpy(tmp, ft_data.debugfs); strcat(tmp, "/tracing/trace_marker"); ft_data.marker_fd = open(tmp, O_WRONLY); - if (ft_data.trace_fd < 0) { + if (ft_data.marker_fd < 0) { log_error("Cannot open trace_marker file %s", tmp); exit(EXIT_FAILURE); } - log_ftrace(ft_data.trace_fd, "1"); log_ftrace(ft_data.marker_fd, "main creates threads\n"); } @@ -936,10 +926,7 @@ int main(int argc, char* argv[]) } if (opts.ftrace) { - log_notice("stopping ftrace"); log_ftrace(ft_data.marker_fd, "main ends\n"); - log_ftrace(ft_data.trace_fd, "0"); - close(ft_data.trace_fd); close(ft_data.marker_fd); } exit(EXIT_SUCCESS); |