提交 73c5d224 编写于 作者: N Namhyung Kim 提交者: Arnaldo Carvalho de Melo

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: NNamhyung 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.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 2565711f
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
#include "header.h" #include "header.h"
#include "vdso.h" #include "vdso.h"
static bool no_buildid_cache;
int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
union perf_event *event, union perf_event *event,
struct perf_sample *sample, struct perf_sample *sample,
...@@ -251,6 +254,11 @@ int dsos__hit_all(struct perf_session *session) ...@@ -251,6 +254,11 @@ int dsos__hit_all(struct perf_session *session)
return 0; return 0;
} }
void disable_buildid_cache(void)
{
no_buildid_cache = true;
}
int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
const char *name, bool is_kallsyms, bool is_vdso) const char *name, bool is_kallsyms, bool is_vdso)
{ {
...@@ -404,6 +412,9 @@ int perf_session__cache_build_ids(struct perf_session *session) ...@@ -404,6 +412,9 @@ int perf_session__cache_build_ids(struct perf_session *session)
int ret; int ret;
char debugdir[PATH_MAX]; char debugdir[PATH_MAX];
if (no_buildid_cache)
return 0;
snprintf(debugdir, sizeof(debugdir), "%s", buildid_dir); snprintf(debugdir, sizeof(debugdir), "%s", buildid_dir);
if (mkdir(debugdir, 0755) != 0 && errno != EEXIST) if (mkdir(debugdir, 0755) != 0 && errno != EEXIST)
......
...@@ -25,5 +25,6 @@ int perf_session__cache_build_ids(struct perf_session *session); ...@@ -25,5 +25,6 @@ int perf_session__cache_build_ids(struct perf_session *session);
int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
const char *name, bool is_kallsyms, bool is_vdso); const char *name, bool is_kallsyms, bool is_vdso);
int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir); int build_id_cache__remove_s(const char *sbuild_id, const char *debugdir);
void disable_buildid_cache(void);
#endif #endif
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include "build-id.h" #include "build-id.h"
#include "data.h" #include "data.h"
static bool no_buildid_cache = false;
static u32 header_argc; static u32 header_argc;
static const char **header_argv; static const char **header_argv;
...@@ -191,8 +189,7 @@ static int write_build_id(int fd, struct perf_header *h, ...@@ -191,8 +189,7 @@ static int write_build_id(int fd, struct perf_header *h,
pr_debug("failed to write buildid table\n"); pr_debug("failed to write buildid table\n");
return err; return err;
} }
if (!no_buildid_cache) perf_session__cache_build_ids(session);
perf_session__cache_build_ids(session);
return 0; return 0;
} }
...@@ -2791,8 +2788,3 @@ int perf_event__process_build_id(struct perf_tool *tool __maybe_unused, ...@@ -2791,8 +2788,3 @@ int perf_event__process_build_id(struct perf_tool *tool __maybe_unused,
session); session);
return 0; return 0;
} }
void disable_buildid_cache(void)
{
no_buildid_cache = true;
}
...@@ -154,7 +154,6 @@ extern void set_die_routine(void (*routine)(const char *err, va_list params) NOR ...@@ -154,7 +154,6 @@ extern void set_die_routine(void (*routine)(const char *err, va_list params) NOR
extern int prefixcmp(const char *str, const char *prefix); extern int prefixcmp(const char *str, const char *prefix);
extern void set_buildid_dir(void); extern void set_buildid_dir(void);
extern void disable_buildid_cache(void);
static inline const char *skip_prefix(const char *str, const char *prefix) static inline const char *skip_prefix(const char *str, const char *prefix)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册