diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2014-07-14 12:02:25 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-16 22:57:33 +0200 |
commit | 1fcb8768636d38cb6fdfeef83a5ee596c4bd9c56 (patch) | |
tree | ffefb332e8e0e035201fbe4b0f4cef9301ac76d1 /tools/perf/util/session.c | |
parent | perf script: Provide additional sample information on generic events (diff) | |
download | linux-1fcb8768636d38cb6fdfeef83a5ee596c4bd9c56.tar.xz linux-1fcb8768636d38cb6fdfeef83a5ee596c4bd9c56.zip |
perf machine: Fix the value used for unknown pids
The value used for unknown pids cannot be zero because that is used by
the "idle" task.
Use -1 instead. Also handle the unknown pid case when creating map
groups.
Note that, threads with an unknown pid should not occur because fork (or
synthesized) events precede the thread's existence.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1405332185-4050-2-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r-- | tools/perf/util/session.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 64a186edc7be..c2f4ca917469 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1083,13 +1083,14 @@ void perf_event_header__bswap(struct perf_event_header *hdr) struct thread *perf_session__findnew(struct perf_session *session, pid_t pid) { - return machine__findnew_thread(&session->machines.host, 0, pid); + return machine__findnew_thread(&session->machines.host, -1, pid); } static struct thread *perf_session__register_idle_thread(struct perf_session *session) { - struct thread *thread = perf_session__findnew(session, 0); + struct thread *thread; + thread = machine__findnew_thread(&session->machines.host, 0, 0); if (thread == NULL || thread__set_comm(thread, "swapper", 0)) { pr_err("problem inserting idle task.\n"); thread = NULL; |