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>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
0a87e7bc6c
commit
cd4ceb6343
@@ -160,6 +160,23 @@ void parse_ftrace_printk(struct pevent *pevent,
|
||||
}
|
||||
}
|
||||
|
||||
void parse_saved_cmdline(struct pevent *pevent,
|
||||
char *file, unsigned int size __maybe_unused)
|
||||
{
|
||||
char *comm;
|
||||
char *line;
|
||||
char *next = NULL;
|
||||
int pid;
|
||||
|
||||
line = strtok_r(file, "\n", &next);
|
||||
while (line) {
|
||||
sscanf(line, "%d %ms", &pid, &comm);
|
||||
pevent_register_comm(pevent, comm, pid);
|
||||
free(comm);
|
||||
line = strtok_r(NULL, "\n", &next);
|
||||
}
|
||||
}
|
||||
|
||||
int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size)
|
||||
{
|
||||
return pevent_parse_event(pevent, buf, size, "ftrace");
|
||||
|
Reference in New Issue
Block a user