perf top: Fix unresolved comm when -s comm is used
authorNamhyung Kim <namhyung@kernel.org>
Wed, 30 Sep 2015 01:45:25 +0000 (10:45 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 1 Oct 2015 12:54:33 +0000 (09:54 -0300)
The perf top uses 'dso,symbol' sort keys by default so it overlooked a
problem in task's comm resolving.  When the sort key contains 'comm',
some task's comm is not shown properly.  This is because the
perf_top__mmap_read_idx() checks the cpumode value improperly.

The cpumode value of non-sample events are 0 (PERF_RECORD_MISC_CPUMODE_
UNKNOWN) so the events will be ignored by the switch statement.  This patch
allows it for non-sample events.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1443577526-3240-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-top.c

index 38d4d6cac8236c01ca0b9b66101196d1a41dec17..ae4c6420300bf8640df2719fd05dad9835d61a82 100644 (file)
@@ -857,9 +857,12 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
                         * TODO: we don't process guest user from host side
                         * except simple counting.
                         */
-                       /* Fall thru */
-               default:
                        goto next_event;
+               default:
+                       if (event->header.type == PERF_RECORD_SAMPLE)
+                               goto next_event;
+                       machine = &session->machines.host;
+                       break;
                }