aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/map.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2014-07-16 04:07:13 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-07-17 09:31:02 -0400
commit29ce36121e6738012aaf00d983d25260627f2b0d (patch)
tree1f76cbf7b31b8439fa1a27b05314aad3450261b8 /tools/perf/util/map.c
parent2afd2bcfc3a026d6e4c2184bf41ccd74eb05758b (diff)
perf machine: Fix map groups of threads with unknown pids
Events like sched_switch do not provide a pid (tgid) which can result in threads with an unknown pid. If the pid is later discovered, join the map groups. Note the thread's map groups should be empty because they are populated by MMAP events which do provide the pid and tid. 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/1405498033-23817-1-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/map.c')
-rw-r--r--tools/perf/util/map.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 25c571f4cba6..7af14807ee90 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -454,6 +454,20 @@ void map_groups__exit(struct map_groups *mg)
454 } 454 }
455} 455}
456 456
457bool map_groups__empty(struct map_groups *mg)
458{
459 int i;
460
461 for (i = 0; i < MAP__NR_TYPES; ++i) {
462 if (maps__first(&mg->maps[i]))
463 return false;
464 if (!list_empty(&mg->removed_maps[i]))
465 return false;
466 }
467
468 return true;
469}
470
457struct map_groups *map_groups__new(void) 471struct map_groups *map_groups__new(void)
458{ 472{
459 struct map_groups *mg = malloc(sizeof(*mg)); 473 struct map_groups *mg = malloc(sizeof(*mg));