aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-buildid-cache.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-cache.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-cache.c')
-rw-r--r--tools/perf/builtin-buildid-cache.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c
index 83654557e108..d37e077f4b14 100644
--- a/tools/perf/builtin-buildid-cache.c
+++ b/tools/perf/builtin-buildid-cache.c
@@ -15,22 +15,6 @@
15#include "util/strlist.h" 15#include "util/strlist.h"
16#include "util/symbol.h" 16#include "util/symbol.h"
17 17
18static char const *add_name_list_str, *remove_name_list_str;
19
20static const char * const buildid_cache_usage[] = {
21 "perf buildid-cache [<options>]",
22 NULL
23};
24
25static const struct option buildid_cache_options[] = {
26 OPT_STRING('a', "add", &add_name_list_str,
27 "file list", "file(s) to add"),
28 OPT_STRING('r', "remove", &remove_name_list_str, "file list",
29 "file(s) to remove"),
30 OPT_INCR('v', "verbose", &verbose, "be more verbose"),
31 OPT_END()
32};
33
34static int build_id_cache__add_file(const char *filename, const char *debugdir) 18static int build_id_cache__add_file(const char *filename, const char *debugdir)
35{ 19{
36 char sbuild_id[BUILD_ID_SIZE * 2 + 1]; 20 char sbuild_id[BUILD_ID_SIZE * 2 + 1];
@@ -51,8 +35,8 @@ static int build_id_cache__add_file(const char *filename, const char *debugdir)
51 return err; 35 return err;
52} 36}
53 37
54static int build_id_cache__remove_file(const char *filename __maybe_unused, 38static int build_id_cache__remove_file(const char *filename,
55 const char *debugdir __maybe_unused) 39 const char *debugdir)
56{ 40{
57 u8 build_id[BUILD_ID_SIZE]; 41 u8 build_id[BUILD_ID_SIZE];
58 char sbuild_id[BUILD_ID_SIZE * 2 + 1]; 42 char sbuild_id[BUILD_ID_SIZE * 2 + 1];
@@ -73,11 +57,34 @@ static int build_id_cache__remove_file(const char *filename __maybe_unused,
73 return err; 57 return err;
74} 58}
75 59
76static int __cmd_buildid_cache(void) 60int cmd_buildid_cache(int argc, const char **argv,
61 const char *prefix __maybe_unused)
77{ 62{
78 struct strlist *list; 63 struct strlist *list;
79 struct str_node *pos; 64 struct str_node *pos;
80 char debugdir[PATH_MAX]; 65 char debugdir[PATH_MAX];
66 char const *add_name_list_str = NULL,
67 *remove_name_list_str = NULL;
68 const struct option buildid_cache_options[] = {
69 OPT_STRING('a', "add", &add_name_list_str,
70 "file list", "file(s) to add"),
71 OPT_STRING('r', "remove", &remove_name_list_str, "file list",
72 "file(s) to remove"),
73 OPT_INCR('v', "verbose", &verbose, "be more verbose"),
74 OPT_END()
75 };
76 const char * const buildid_cache_usage[] = {
77 "perf buildid-cache [<options>]",
78 NULL
79 };
80
81 argc = parse_options(argc, argv, buildid_cache_options,
82 buildid_cache_usage, 0);
83
84 if (symbol__init() < 0)
85 return -1;
86
87 setup_pager();
81 88
82 snprintf(debugdir, sizeof(debugdir), "%s", buildid_dir); 89 snprintf(debugdir, sizeof(debugdir), "%s", buildid_dir);
83 90
@@ -119,16 +126,3 @@ static int __cmd_buildid_cache(void)
119 126
120 return 0; 127 return 0;
121} 128}
122
123int cmd_buildid_cache(int argc, const char **argv,
124 const char *prefix __maybe_unused)
125{
126 argc = parse_options(argc, argv, buildid_cache_options,
127 buildid_cache_usage, 0);
128
129 if (symbol__init() < 0)
130 return -1;
131
132 setup_pager();
133 return __cmd_buildid_cache();
134}