aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2014-11-07 08:57:56 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-11-19 10:33:46 -0500
commit73c5d224b4514575abe0dd89b43adbde937429c3 (patch)
tree779f3f233e33e3d05553fead865c8ea261389b59
parent2565711fb7d7c28e0cd93c8971b520d1b10b857c (diff)
perf build-id: Move disable_buildid_cache() to util/build-id.c
Also move static variable no_buildid_cache and check it in the perf_session_cache_build_ids(). Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Aravinda Prasad <aravinda@linux.vnet.ibm.com> Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Hemant Kumar <hemant@linux.vnet.ibm.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Pekka Enberg <penberg@iki.fi> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Cc: systemtap@sourceware.org Link: http://lkml.kernel.org/r/1415368677-3794-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/build-id.c11
-rw-r--r--tools/perf/util/build-id.h1
-rw-r--r--tools/perf/util/header.c10
-rw-r--r--tools/perf/util/util.h1
4 files changed, 13 insertions, 10 deletions
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index dd2a3e52ada1..e8d79e5bfaf7 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -18,6 +18,9 @@
18#include "header.h" 18#include "header.h"
19#include "vdso.h" 19#include "vdso.h"
20 20
21
22static bool no_buildid_cache;
23
21int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, 24int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
22 union perf_event *event, 25 union perf_event *event,
23 struct perf_sample *sample, 26 struct perf_sample *sample,
@@ -251,6 +254,11 @@ int dsos__hit_all(struct perf_session *session)
251 return 0; 254 return 0;
252} 255}
253 256
257void disable_buildid_cache(void)
258{
259 no_buildid_cache = true;
260}
261
254int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, 262int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
255 const char *name, bool is_kallsyms, bool is_vdso) 263 const char *name, bool is_kallsyms, bool is_vdso)
256{ 264{
@@ -404,6 +412,9 @@ int perf_session__cache_build_ids(struct perf_session *session)
404 int ret; 412 int ret;
405 char debugdir[PATH_MAX]; 413 char debugdir[PATH_MAX];
406 414
415 if (no_buildid_cache)
416 return 0;
417
407 snprintf(debugdir, sizeof(debugdir), "%s", buildid_dir); 418 snprintf(debugdir, sizeof(debugdir), "%s", buildid_dir);
408 419
409 if (mkdir(debugdir, 0755) != 0 && errno != EEXIST) 420 if (mkdir(debugdir, 0755) != 0 && errno != EEXIST)
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
index 666a3bd4f64e..8236319514d5 100644
--- a/tools/perf/util/build-id.h
+++ b/tools/perf/util/build-id.h
@@ -25,5 +25,6 @@ int perf_session__cache_build_ids(struct perf_session *session);
25int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, 25int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
26 const char *name, bool is_kallsyms, bool is_vdso); 26 const char *name, bool is_kallsyms, bool is_vdso);
27int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir); 27int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir);
28void disable_buildid_cache(void);
28 29
29#endif 30#endif
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 05fab7a188dc..b20e40c74468 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -24,8 +24,6 @@
24#include "build-id.h" 24#include "build-id.h"
25#include "data.h" 25#include "data.h"
26 26
27static bool no_buildid_cache = false;
28
29static u32 header_argc; 27static u32 header_argc;
30static const char **header_argv; 28static const char **header_argv;
31 29
@@ -191,8 +189,7 @@ static int write_build_id(int fd, struct perf_header *h,
191 pr_debug("failed to write buildid table\n"); 189 pr_debug("failed to write buildid table\n");
192 return err; 190 return err;
193 } 191 }
194 if (!no_buildid_cache) 192 perf_session__cache_build_ids(session);
195 perf_session__cache_build_ids(session);
196 193
197 return 0; 194 return 0;
198} 195}
@@ -2791,8 +2788,3 @@ int perf_event__process_build_id(struct perf_tool *tool __maybe_unused,
2791 session); 2788 session);
2792 return 0; 2789 return 0;
2793} 2790}
2794
2795void disable_buildid_cache(void)
2796{
2797 no_buildid_cache = true;
2798}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 7dc44cfe25b3..76d23d83eae5 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -154,7 +154,6 @@ extern void set_die_routine(void (*routine)(const char *err, va_list params) NOR
154 154
155extern int prefixcmp(const char *str, const char *prefix); 155extern int prefixcmp(const char *str, const char *prefix);
156extern void set_buildid_dir(void); 156extern void set_buildid_dir(void);
157extern void disable_buildid_cache(void);
158 157
159static inline const char *skip_prefix(const char *str, const char *prefix) 158static inline const char *skip_prefix(const char *str, const char *prefix)
160{ 159{