aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/map.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-07-23 11:06:16 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-07-23 11:28:36 -0300
commite6ce712634ea038ce42bbb11932b692696756882 (patch)
treebdefdc3edf5cd341e5106ba344f8ae864ab5e1f1 /tools/perf/util/map.c
parentperf symbols: Add front end cache for DSO symbol lookup (diff)
downloadlinux-dev-e6ce712634ea038ce42bbb11932b692696756882.tar.xz
linux-dev-e6ce712634ea038ce42bbb11932b692696756882.zip
perf symbols: Introduce map__is_(kernel,kmodule)()
To, with members we already have, check if a kernel level map is for the kernel proper or for a module. Acked-by: David Ahern <dsahern@gmail.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-m5ic7h0z2crmtj7vi1a1rj3b@git.kernel.org 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 b5a5e9c02437..ce37e95bc513 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -224,6 +224,20 @@ struct map *map__new2(u64 start, struct dso *dso, enum map_type type)
return map;
}
+/*
+ * Use this and __map__is_kmodule() for map instances that are in
+ * machine->kmaps, and thus have map->groups->machine all properly set, to
+ * disambiguate between the kernel and modules.
+ *
+ * When the need arises, introduce map__is_{kernel,kmodule)() that
+ * checks (map->groups != NULL && map->groups->machine != NULL &&
+ * map->dso->kernel) before calling __map__is_{kernel,kmodule}())
+ */
+bool __map__is_kernel(const struct map *map)
+{
+ return map->groups->machine->vmlinux_maps[map->type] == map;
+}
+
static void map__exit(struct map *map)
{
BUG_ON(!RB_EMPTY_NODE(&map->rb_node));