diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-22 19:44:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-22 19:44:39 -0400 |
commit | 4d4abdcb1dee03a4f9d6d2021622ed07e14dfd17 (patch) | |
tree | 4ed4c74b70240451065165fda5fb2059f8c6b1e5 /tools/perf/builtin-annotate.c | |
parent | 0342cbcfced2ee937d7c8e1c63f3d3082da7c7dc (diff) | |
parent | 7fcfd1abd6480d3b9ef17f5759c175e036e835cf (diff) |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (123 commits)
perf: Remove the nmi parameter from the oprofile_perf backend
x86, perf: Make copy_from_user_nmi() a library function
perf: Remove perf_event_attr::type check
x86, perf: P4 PMU - Fix typos in comments and style cleanup
perf tools: Make test use the preset debugfs path
perf tools: Add automated tests for events parsing
perf tools: De-opt the parse_events function
perf script: Fix display of IP address for non-callchain path
perf tools: Fix endian conversion reading event attr from file header
perf tools: Add missing 'node' alias to the hw_cache[] array
perf probe: Support adding probes on offline kernel modules
perf probe: Add probed module in front of function
perf probe: Introduce debuginfo to encapsulate dwarf information
perf-probe: Move dwarf library routines to dwarf-aux.{c, h}
perf probe: Remove redundant dwarf functions
perf probe: Move strtailcmp to string.c
perf probe: Rename DIE_FIND_CB_FOUND to DIE_FIND_CB_END
tracing/kprobe: Update symbol reference when loading module
tracing/kprobes: Support module init function probing
kprobes: Return -ENOENT if probe point doesn't exist
...
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r-- | tools/perf/builtin-annotate.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 7b139e1e7e86..555aefd7fe01 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include "util/hist.h" | 28 | #include "util/hist.h" |
29 | #include "util/session.h" | 29 | #include "util/session.h" |
30 | 30 | ||
31 | #include <linux/bitmap.h> | ||
32 | |||
31 | static char const *input_name = "perf.data"; | 33 | static char const *input_name = "perf.data"; |
32 | 34 | ||
33 | static bool force, use_tui, use_stdio; | 35 | static bool force, use_tui, use_stdio; |
@@ -38,6 +40,9 @@ static bool print_line; | |||
38 | 40 | ||
39 | static const char *sym_hist_filter; | 41 | static const char *sym_hist_filter; |
40 | 42 | ||
43 | static const char *cpu_list; | ||
44 | static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); | ||
45 | |||
41 | static int perf_evlist__add_sample(struct perf_evlist *evlist, | 46 | static int perf_evlist__add_sample(struct perf_evlist *evlist, |
42 | struct perf_sample *sample, | 47 | struct perf_sample *sample, |
43 | struct perf_evsel *evsel, | 48 | struct perf_evsel *evsel, |
@@ -90,6 +95,9 @@ static int process_sample_event(union perf_event *event, | |||
90 | return -1; | 95 | return -1; |
91 | } | 96 | } |
92 | 97 | ||
98 | if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) | ||
99 | return 0; | ||
100 | |||
93 | if (!al.filtered && | 101 | if (!al.filtered && |
94 | perf_evlist__add_sample(session->evlist, sample, evsel, &al)) { | 102 | perf_evlist__add_sample(session->evlist, sample, evsel, &al)) { |
95 | pr_warning("problem incrementing symbol count, " | 103 | pr_warning("problem incrementing symbol count, " |
@@ -177,6 +185,12 @@ static int __cmd_annotate(void) | |||
177 | if (session == NULL) | 185 | if (session == NULL) |
178 | return -ENOMEM; | 186 | return -ENOMEM; |
179 | 187 | ||
188 | if (cpu_list) { | ||
189 | ret = perf_session__cpu_bitmap(session, cpu_list, cpu_bitmap); | ||
190 | if (ret) | ||
191 | goto out_delete; | ||
192 | } | ||
193 | |||
180 | ret = perf_session__process_events(session, &event_ops); | 194 | ret = perf_session__process_events(session, &event_ops); |
181 | if (ret) | 195 | if (ret) |
182 | goto out_delete; | 196 | goto out_delete; |
@@ -252,6 +266,7 @@ static const struct option options[] = { | |||
252 | "print matching source lines (may be slow)"), | 266 | "print matching source lines (may be slow)"), |
253 | OPT_BOOLEAN('P', "full-paths", &full_paths, | 267 | OPT_BOOLEAN('P', "full-paths", &full_paths, |
254 | "Don't shorten the displayed pathnames"), | 268 | "Don't shorten the displayed pathnames"), |
269 | OPT_STRING('c', "cpu", &cpu_list, "cpu", "list of cpus to profile"), | ||
255 | OPT_END() | 270 | OPT_END() |
256 | }; | 271 | }; |
257 | 272 | ||