[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-m5ic7h0z2crmtj7vi1a1rj3b@git.kernel.org>
Date: Wed, 29 Jul 2015 01:12:09 -0700
From: tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: hpa@...or.com, bp@...e.de, tglx@...utronix.de, jolsa@...hat.com,
eranian@...gle.com, adrian.hunter@...el.com, acme@...hat.com,
dsahern@...il.com, namhyung@...nel.org, mingo@...nel.org,
fweisbec@...il.com, linux-kernel@...r.kernel.org
Subject: [tip:perf/core] perf symbols: Introduce map__is_(kernel,kmodule)(
)
Commit-ID: e6ce712634ea038ce42bbb11932b692696756882
Gitweb: http://git.kernel.org/tip/e6ce712634ea038ce42bbb11932b692696756882
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Thu, 23 Jul 2015 11:06:16 -0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 23 Jul 2015 11:28:36 -0300
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@...il.com>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Borislav Petkov <bp@...e.de>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Stephane Eranian <eranian@...gle.com>
Link: http://lkml.kernel.org/n/tip-m5ic7h0z2crmtj7vi1a1rj3b@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/map.c | 14 ++++++++++++++
tools/perf/util/map.h | 7 +++++++
2 files changed, 21 insertions(+)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index b5a5e9c..ce37e95 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));
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index d73e687..57829e8 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -256,4 +256,11 @@ int map_groups__fixup_overlappings(struct map_groups *mg, struct map *map,
struct map *map_groups__find_by_name(struct map_groups *mg,
enum map_type type, const char *name);
+bool __map__is_kernel(const struct map *map);
+
+static inline bool __map__is_kmodule(const struct map *map)
+{
+ return !__map__is_kernel(map);
+}
+
#endif /* __PERF_MAP_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists