[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-93iqzayafpaxaguoiwjqezgz@git.kernel.org>
Date: Thu, 12 Jan 2017 00:29:11 -0800
From: tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, jolsa@...nel.org,
mhiramat@...nel.org, namhyung@...nel.org, dsahern@...il.com,
mingo@...nel.org, acme@...hat.com, adrian.hunter@...el.com,
hpa@...or.com, wangnan0@...wei.com, tglx@...utronix.de
Subject: [tip:perf/core] perf machine: Add a kallsyms loading constructor
Commit-ID: 7d132caaf9392853ad637c8e6e53333cbeb99aa5
Gitweb: http://git.kernel.org/tip/7d132caaf9392853ad637c8e6e53333cbeb99aa5
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Thu, 5 Jan 2017 15:31:48 -0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 11 Jan 2017 16:48:00 -0300
perf machine: Add a kallsyms loading constructor
To reduce the boilerplate for searching for functions in the running
kernel and modules.
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/n/tip-93iqzayafpaxaguoiwjqezgz@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/machine.c | 19 +++++++++++++++++++
tools/perf/util/machine.h | 1 +
2 files changed, 20 insertions(+)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 9b33bef..747a034 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -87,6 +87,25 @@ out_delete:
return NULL;
}
+struct machine *machine__new_kallsyms(void)
+{
+ struct machine *machine = machine__new_host();
+ /*
+ * FIXME:
+ * 1) MAP__FUNCTION will go away when we stop loading separate maps for
+ * functions and data objects.
+ * 2) We should switch to machine__load_kallsyms(), i.e. not explicitely
+ * ask for not using the kcore parsing code, once this one is fixed
+ * to create a map per module.
+ */
+ if (machine && __machine__load_kallsyms(machine, "/proc/kallsyms", MAP__FUNCTION, true) <= 0) {
+ machine__delete(machine);
+ machine = NULL;
+ }
+
+ return machine;
+}
+
static void dsos__purge(struct dsos *dsos)
{
struct dso *pos, *n;
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
index 354de6e..a283050 100644
--- a/tools/perf/util/machine.h
+++ b/tools/perf/util/machine.h
@@ -129,6 +129,7 @@ char *machine__mmap_name(struct machine *machine, char *bf, size_t size);
void machines__set_comm_exec(struct machines *machines, bool comm_exec);
struct machine *machine__new_host(void);
+struct machine *machine__new_kallsyms(void);
int machine__init(struct machine *machine, const char *root_dir, pid_t pid);
void machine__exit(struct machine *machine);
void machine__delete_threads(struct machine *machine);
Powered by blists - more mailing lists