diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-04-11 04:25:04 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-01-26 09:42:59 -0500 |
commit | cd4ceb63438e9e28299f4352ae7b75d2967a772d (patch) | |
tree | 0c1e0fb0dfee28f9f216f4ab5eec2b8a312e2d0f /tools/perf/util/trace-event-parse.c | |
parent | 0a87e7bc6c55dd248270ee0ab4212cd0ef8ea04a (diff) |
perf util: Save pid-cmdline mapping into tracing header
Current trace info data lacks the saved cmdline mapping which is needed
for pevent to find out the comm of a task. Add this and bump up the
version number so that perf can determine its presence when reading.
This is mostly corresponding to trace.dat file version 6, but still
lacks 4 byte of number of cpus, and 10 bytes of type string - and I
think we don't need those anyway.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jeremy Eder <jeder@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>,
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
[ Change version test from == to >= ]
Link: http://lkml.kernel.org/n/tip-vaooqpxsikxbb3359p0corcb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/trace-event-parse.c')
-rw-r--r-- | tools/perf/util/trace-event-parse.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 33b52eaa39db..de0078e21408 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -160,6 +160,23 @@ void parse_ftrace_printk(struct pevent *pevent, | |||
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | void parse_saved_cmdline(struct pevent *pevent, | ||
164 | char *file, unsigned int size __maybe_unused) | ||
165 | { | ||
166 | char *comm; | ||
167 | char *line; | ||
168 | char *next = NULL; | ||
169 | int pid; | ||
170 | |||
171 | line = strtok_r(file, "\n", &next); | ||
172 | while (line) { | ||
173 | sscanf(line, "%d %ms", &pid, &comm); | ||
174 | pevent_register_comm(pevent, comm, pid); | ||
175 | free(comm); | ||
176 | line = strtok_r(NULL, "\n", &next); | ||
177 | } | ||
178 | } | ||
179 | |||
163 | int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size) | 180 | int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size) |
164 | { | 181 | { |
165 | return pevent_parse_event(pevent, buf, size, "ftrace"); | 182 | return pevent_parse_event(pevent, buf, size, "ftrace"); |