From 45030a13bec3739b91b7ce5aa02d846712caf1e0 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 1 Oct 2012 15:20:58 -0300 Subject: [PATCH] --- yaml --- r: 333947 b: refs/heads/master c: 6ee4149736e39deb7ed6d11c5de3101b5b8c2669 h: refs/heads/master i: 333945: a41542d1b64fd1b96ce0bc288396ab1e1fda65b7 333943: e3fb0dfb623294a9f87621dc6acfc78bd267ad70 v: v3 --- [refs] | 2 +- trunk/tools/perf/builtin-buildid-list.c | 55 +++++++++++-------------- 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/[refs] b/[refs] index ad5589990277..c30868aa9bc1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 472cc83c3296cdc9248f1afbcfae8bba0f6f9707 +refs/heads/master: 6ee4149736e39deb7ed6d11c5de3101b5b8c2669 diff --git a/trunk/tools/perf/builtin-buildid-list.c b/trunk/tools/perf/builtin-buildid-list.c index 1159feeebb19..a0e94fffa03e 100644 --- a/trunk/tools/perf/builtin-buildid-list.c +++ b/trunk/tools/perf/builtin-buildid-list.c @@ -16,27 +16,6 @@ #include "util/session.h" #include "util/symbol.h" -static const char *input_name; -static bool force; -static bool show_kernel; -static bool with_hits; - -static const char * const buildid_list_usage[] = { - "perf buildid-list []", - NULL -}; - -static const struct option options[] = { - OPT_BOOLEAN('H', "with-hits", &with_hits, "Show only DSOs with hits"), - OPT_STRING('i', "input", &input_name, "file", - "input file name"), - OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), - OPT_BOOLEAN('k', "kernel", &show_kernel, "Show current kernel build id"), - OPT_INCR('v', "verbose", &verbose, - "be more verbose"), - OPT_END() -}; - static int sysfs__fprintf_build_id(FILE *fp) { u8 kallsyms_build_id[BUILD_ID_SIZE]; @@ -65,7 +44,8 @@ static int filename__fprintf_build_id(const char *name, FILE *fp) return fprintf(fp, "%s\n", sbuild_id); } -static int perf_session__list_build_ids(void) +static int perf_session__list_build_ids(const char *input_name, + bool force, bool with_hits) { struct perf_session *session; @@ -95,18 +75,31 @@ static int perf_session__list_build_ids(void) return 0; } -static int __cmd_buildid_list(void) -{ - if (show_kernel) - return sysfs__fprintf_build_id(stdout); - - return perf_session__list_build_ids(); -} - int cmd_buildid_list(int argc, const char **argv, const char *prefix __maybe_unused) { + bool show_kernel = false; + bool with_hits = false; + bool force = false; + const char *input_name = NULL; + const struct option options[] = { + OPT_BOOLEAN('H', "with-hits", &with_hits, "Show only DSOs with hits"), + OPT_STRING('i', "input", &input_name, "file", "input file name"), + OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), + OPT_BOOLEAN('k', "kernel", &show_kernel, "Show current kernel build id"), + OPT_INCR('v', "verbose", &verbose, "be more verbose"), + OPT_END() + }; + const char * const buildid_list_usage[] = { + "perf buildid-list []", + NULL + }; + argc = parse_options(argc, argv, options, buildid_list_usage, 0); setup_pager(); - return __cmd_buildid_list(); + + if (show_kernel) + return sysfs__fprintf_build_id(stdout); + + return perf_session__list_build_ids(input_name, force, with_hits); }