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:
Namhyung Kim
2013-04-11 17:25:04 +09:00
committed by Arnaldo Carvalho de Melo
parent 0a87e7bc6c
commit cd4ceb6343
4 changed files with 84 additions and 3 deletions

View File

@@ -42,7 +42,7 @@
#include "evsel.h"
#include "debug.h"
#define VERSION "0.5"
#define VERSION "0.6"
static int output_fd;
@@ -379,6 +379,34 @@ out:
return err;
}
static int record_saved_cmdline(void)
{
unsigned int size;
char *path;
struct stat st;
int ret, err = 0;
path = get_tracing_file("saved_cmdlines");
if (!path) {
pr_debug("can't get tracing/saved_cmdline");
return -ENOMEM;
}
ret = stat(path, &st);
if (ret < 0) {
/* not found */
size = 0;
if (write(output_fd, &size, 8) != 8)
err = -EIO;
goto out;
}
err = record_file(path, 8);
out:
put_tracing_file(path);
return err;
}
static void
put_tracepoints_path(struct tracepoint_path *tps)
{
@@ -539,6 +567,9 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
if (err)
goto out;
err = record_ftrace_printk();
if (err)
goto out;
err = record_saved_cmdline();
out:
/*