[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-9bae1e8c3fe5359ce17309b894f54667fd563e98@git.kernel.org>
Date: Wed, 16 Sep 2015 00:28:22 -0700
From: tip-bot for Namhyung Kim <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com,
masami.hiramatsu.pt@...achi.com, tglx@...utronix.de,
jolsa@...hat.com, wangnan0@...wei.com, namhyung@...nel.org,
a.p.zijlstra@...llo.nl, acme@...hat.com, mingo@...nel.org
Subject: [tip:perf/core] perf probe: Export init/exit_probe_symbol_maps()
Commit-ID: 9bae1e8c3fe5359ce17309b894f54667fd563e98
Gitweb: http://git.kernel.org/tip/9bae1e8c3fe5359ce17309b894f54667fd563e98
Author: Namhyung Kim <namhyung@...nel.org>
AuthorDate: Thu, 10 Sep 2015 11:27:05 +0900
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 15 Sep 2015 09:48:32 -0300
perf probe: Export init/exit_probe_symbol_maps()
The init/exit_symbols_maps() functions are to setup and cleanup
necessary info for probe events. But they need to be called from out of
the probe code now, so this patch exports them.
However the names are too generic, so change them to have 'probe'. :)
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/r/1441852026-28974-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/builtin-probe.c | 5 +++++
tools/perf/util/probe-event.c | 31 +++++++++++++++----------------
tools/perf/util/probe-event.h | 2 ++
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 2bec9c1..94385ee 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -317,6 +317,10 @@ static int perf_add_probe_events(struct perf_probe_event *pevs, int npevs)
int i, k;
const char *event = NULL, *group = NULL;
+ ret = init_probe_symbol_maps(pevs->uprobes);
+ if (ret < 0)
+ return ret;
+
ret = convert_perf_probe_events(pevs, npevs);
if (ret < 0)
goto out_cleanup;
@@ -354,6 +358,7 @@ static int perf_add_probe_events(struct perf_probe_event *pevs, int npevs)
out_cleanup:
cleanup_perf_probe_events(pevs, npevs);
+ exit_probe_symbol_maps();
return ret;
}
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 3d7d60c..2b78e8f 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -71,7 +71,7 @@ static char *synthesize_perf_probe_point(struct perf_probe_point *pp);
static struct machine *host_machine;
/* Initialize symbol maps and path of vmlinux/modules */
-static int init_symbol_maps(bool user_only)
+int init_probe_symbol_maps(bool user_only)
{
int ret;
@@ -101,7 +101,7 @@ out:
return ret;
}
-static void exit_symbol_maps(void)
+void exit_probe_symbol_maps(void)
{
if (host_machine) {
machine__delete(host_machine);
@@ -859,11 +859,11 @@ int show_line_range(struct line_range *lr, const char *module, bool user)
{
int ret;
- ret = init_symbol_maps(user);
+ ret = init_probe_symbol_maps(user);
if (ret < 0)
return ret;
ret = __show_line_range(lr, module, user);
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
@@ -941,7 +941,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
int i, ret = 0;
struct debuginfo *dinfo;
- ret = init_symbol_maps(pevs->uprobes);
+ ret = init_probe_symbol_maps(pevs->uprobes);
if (ret < 0)
return ret;
@@ -958,7 +958,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
debuginfo__delete(dinfo);
out:
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
@@ -2262,7 +2262,7 @@ int show_perf_probe_events(struct strfilter *filter)
setup_pager();
- ret = init_symbol_maps(false);
+ ret = init_probe_symbol_maps(false);
if (ret < 0)
return ret;
@@ -2278,7 +2278,7 @@ int show_perf_probe_events(struct strfilter *filter)
close(kp_fd);
if (up_fd > 0)
close(up_fd);
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
@@ -2746,10 +2746,6 @@ int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs)
{
int i, ret;
- ret = init_symbol_maps(pevs->uprobes);
- if (ret < 0)
- return ret;
-
/* Loop 1: convert all events */
for (i = 0; i < npevs; i++) {
/* Init kprobe blacklist if needed */
@@ -2794,20 +2790,23 @@ void cleanup_perf_probe_events(struct perf_probe_event *pevs, int npevs)
pevs[i].ntevs = 0;
clear_perf_probe_event(&pevs[i]);
}
-
- exit_symbol_maps();
}
int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
{
int ret;
+ ret = init_probe_symbol_maps(pevs->uprobes);
+ if (ret < 0)
+ return ret;
+
ret = convert_perf_probe_events(pevs, npevs);
if (ret == 0)
ret = apply_perf_probe_events(pevs, npevs);
cleanup_perf_probe_events(pevs, npevs);
+ exit_probe_symbol_maps();
return ret;
}
@@ -2867,7 +2866,7 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
struct map *map;
int ret;
- ret = init_symbol_maps(user);
+ ret = init_probe_symbol_maps(user);
if (ret < 0)
return ret;
@@ -2897,7 +2896,7 @@ end:
if (user) {
map__put(map);
}
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h
index 9bcea36..ba926c3 100644
--- a/tools/perf/util/probe-event.h
+++ b/tools/perf/util/probe-event.h
@@ -110,6 +110,8 @@ struct variable_list {
};
struct map;
+int init_probe_symbol_maps(bool user_only);
+void exit_probe_symbol_maps(void);
/* Command string to events */
extern int parse_perf_probe_command(const char *cmd,
--
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