aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-buildid-list.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 21:20:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 21:20:11 -0400
commitade0899b298ba2c43bfd6abd8cbc2545944cde0c (patch)
treea448dfb440b3b958b6306bb43620cd5d76f504bf /tools/perf/builtin-buildid-list.c
parent871a0596cb2f51b57dc583d1a7c4be0186582fe7 (diff)
parent95cf59ea72331d0093010543b8951bb43f262cac (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar: "This tree includes some late late perf items that missed the first round: tools: - Bash auto completion improvements, now we can auto complete the tools long options, tracepoint event names, etc, from Namhyung Kim. - Look up thread using tid instead of pid in 'perf sched'. - Move global variables into a perf_kvm struct, from David Ahern. - Hists refactorings, preparatory for improved 'diff' command, from Jiri Olsa. - Hists refactorings, preparatory for event group viewieng work, from Namhyung Kim. - Remove double negation on optional feature macro definitions, from Namhyung Kim. - Remove several cases of needless global variables, on most builtins. - misc fixes kernel: - sysfs support for IBS on AMD CPUs, from Robert Richter. - Support for an upcoming Intel CPU, the Xeon-Phi / Knights Corner HPC blade PMU, from Vince Weaver. - misc fixes" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits) perf: Fix perf_cgroup_switch for sw-events perf: Clarify perf_cpu_context::active_pmu usage by renaming it to ::unique_pmu perf/AMD/IBS: Add sysfs support perf hists: Add more helpers for hist entry stat perf hists: Move he->stat.nr_events initialization to a template perf hists: Introduce struct he_stat perf diff: Removing the total_period argument from output code perf tool: Add hpp interface to enable/disable hpp column perf tools: Removing hists pair argument from output path perf hists: Separate overhead and baseline columns perf diff: Refactor diff displacement possition info perf hists: Add struct hists pointer to struct hist_entry perf tools: Complete tracepoint event names perf/x86: Add support for Intel Xeon-Phi Knights Corner PMU perf evlist: Remove some unused methods perf evlist: Introduce add_newtp method perf kvm: Move global variables into a perf_kvm struct perf tools: Convert to BACKTRACE_SUPPORT perf tools: Long option completion support for each subcommands perf tools: Complete long option names of perf command ...
Diffstat (limited to 'tools/perf/builtin-buildid-list.c')
-rw-r--r--tools/perf/builtin-buildid-list.c55
1 files changed, 24 insertions, 31 deletions
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
index 1159feeebb19..a0e94fffa03e 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -16,27 +16,6 @@
16#include "util/session.h" 16#include "util/session.h"
17#include "util/symbol.h" 17#include "util/symbol.h"
18 18
19static const char *input_name;
20static bool force;
21static bool show_kernel;
22static bool with_hits;
23
24static const char * const buildid_list_usage[] = {
25 "perf buildid-list [<options>]",
26 NULL
27};
28
29static const struct option options[] = {
30 OPT_BOOLEAN('H', "with-hits", &with_hits, "Show only DSOs with hits"),
31 OPT_STRING('i', "input", &input_name, "file",
32 "input file name"),
33 OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
34 OPT_BOOLEAN('k', "kernel", &show_kernel, "Show current kernel build id"),
35 OPT_INCR('v', "verbose", &verbose,
36 "be more verbose"),
37 OPT_END()
38};
39
40static int sysfs__fprintf_build_id(FILE *fp) 19static int sysfs__fprintf_build_id(FILE *fp)
41{ 20{
42 u8 kallsyms_build_id[BUILD_ID_SIZE]; 21 u8 kallsyms_build_id[BUILD_ID_SIZE];
@@ -65,7 +44,8 @@ static int filename__fprintf_build_id(const char *name, FILE *fp)
65 return fprintf(fp, "%s\n", sbuild_id); 44 return fprintf(fp, "%s\n", sbuild_id);
66} 45}
67 46
68static int perf_session__list_build_ids(void) 47static int perf_session__list_build_ids(const char *input_name,
48 bool force, bool with_hits)
69{ 49{
70 struct perf_session *session; 50 struct perf_session *session;
71 51
@@ -95,18 +75,31 @@ out:
95 return 0; 75 return 0;
96} 76}
97 77
98static int __cmd_buildid_list(void)
99{
100 if (show_kernel)
101 return sysfs__fprintf_build_id(stdout);
102
103 return perf_session__list_build_ids();
104}
105
106int cmd_buildid_list(int argc, const char **argv, 78int cmd_buildid_list(int argc, const char **argv,
107 const char *prefix __maybe_unused) 79 const char *prefix __maybe_unused)
108{ 80{
81 bool show_kernel = false;
82 bool with_hits = false;
83 bool force = false;
84 const char *input_name = NULL;
85 const struct option options[] = {
86 OPT_BOOLEAN('H', "with-hits", &with_hits, "Show only DSOs with hits"),
87 OPT_STRING('i', "input", &input_name, "file", "input file name"),
88 OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
89 OPT_BOOLEAN('k', "kernel", &show_kernel, "Show current kernel build id"),
90 OPT_INCR('v', "verbose", &verbose, "be more verbose"),
91 OPT_END()
92 };
93 const char * const buildid_list_usage[] = {
94 "perf buildid-list [<options>]",
95 NULL
96 };
97
109 argc = parse_options(argc, argv, options, buildid_list_usage, 0); 98 argc = parse_options(argc, argv, options, buildid_list_usage, 0);
110 setup_pager(); 99 setup_pager();
111 return __cmd_buildid_list(); 100
101 if (show_kernel)
102 return sysfs__fprintf_build_id(stdout);
103
104 return perf_session__list_build_ids(input_name, force, with_hits);
112} 105}