diff options
author | Tejun Heo <tj@kernel.org> | 2011-11-28 12:46:22 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-11-28 12:46:22 -0500 |
commit | d4bbf7e7759afc172e2bfbc5c416324590049cdd (patch) | |
tree | 7eab5ee5481cd3dcf1162329fec827177640018a /tools/perf/builtin-annotate.c | |
parent | a150439c4a97db379f0ed6faa46fbbb6e7bf3cb2 (diff) | |
parent | 401d0069cb344f401bc9d264c31db55876ff78c0 (diff) |
Merge branch 'master' into x86/memblock
Conflicts & resolutions:
* arch/x86/xen/setup.c
dc91c728fd "xen: allow extra memory to be in multiple regions"
24aa07882b "memblock, x86: Replace memblock_x86_reserve/free..."
conflicted on xen_add_extra_mem() updates. The resolution is
trivial as the latter just want to replace
memblock_x86_reserve_range() with memblock_reserve().
* drivers/pci/intel-iommu.c
166e9278a3f "x86/ia64: intel-iommu: move to drivers/iommu/"
5dfe8660a3d "bootmem: Replace work_with_active_regions() with..."
conflicted as the former moved the file under drivers/iommu/.
Resolved by applying the chnages from the latter on the moved
file.
* mm/Kconfig
6661672053a "memblock: add NO_BOOTMEM config symbol"
c378ddd53f9 "memblock, x86: Make ARCH_DISCARD_MEMBLOCK a config option"
conflicted trivially. Both added config options. Just
letting both add their own options resolves the conflict.
* mm/memblock.c
d1f0ece6cdc "mm/memblock.c: small function definition fixes"
ed7b56a799c "memblock: Remove memblock_memory_can_coalesce()"
confliected. The former updates function removed by the
latter. Resolution is trivial.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r-- | tools/perf/builtin-annotate.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 7b139e1e7e86..46b4c24f338e 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, " |
@@ -106,10 +114,11 @@ static int hist_entry__tty_annotate(struct hist_entry *he, int evidx) | |||
106 | print_line, full_paths, 0, 0); | 114 | print_line, full_paths, 0, 0); |
107 | } | 115 | } |
108 | 116 | ||
109 | static void hists__find_annotations(struct hists *self, int evidx) | 117 | static void hists__find_annotations(struct hists *self, int evidx, |
118 | int nr_events) | ||
110 | { | 119 | { |
111 | struct rb_node *nd = rb_first(&self->entries), *next; | 120 | struct rb_node *nd = rb_first(&self->entries), *next; |
112 | int key = KEY_RIGHT; | 121 | int key = K_RIGHT; |
113 | 122 | ||
114 | while (nd) { | 123 | while (nd) { |
115 | struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node); | 124 | struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node); |
@@ -121,7 +130,7 @@ static void hists__find_annotations(struct hists *self, int evidx) | |||
121 | notes = symbol__annotation(he->ms.sym); | 130 | notes = symbol__annotation(he->ms.sym); |
122 | if (notes->src == NULL) { | 131 | if (notes->src == NULL) { |
123 | find_next: | 132 | find_next: |
124 | if (key == KEY_LEFT) | 133 | if (key == K_LEFT) |
125 | nd = rb_prev(nd); | 134 | nd = rb_prev(nd); |
126 | else | 135 | else |
127 | nd = rb_next(nd); | 136 | nd = rb_next(nd); |
@@ -129,12 +138,13 @@ find_next: | |||
129 | } | 138 | } |
130 | 139 | ||
131 | if (use_browser > 0) { | 140 | if (use_browser > 0) { |
132 | key = hist_entry__tui_annotate(he, evidx); | 141 | key = hist_entry__tui_annotate(he, evidx, nr_events, |
142 | NULL, NULL, 0); | ||
133 | switch (key) { | 143 | switch (key) { |
134 | case KEY_RIGHT: | 144 | case K_RIGHT: |
135 | next = rb_next(nd); | 145 | next = rb_next(nd); |
136 | break; | 146 | break; |
137 | case KEY_LEFT: | 147 | case K_LEFT: |
138 | next = rb_prev(nd); | 148 | next = rb_prev(nd); |
139 | break; | 149 | break; |
140 | default: | 150 | default: |
@@ -177,6 +187,12 @@ static int __cmd_annotate(void) | |||
177 | if (session == NULL) | 187 | if (session == NULL) |
178 | return -ENOMEM; | 188 | return -ENOMEM; |
179 | 189 | ||
190 | if (cpu_list) { | ||
191 | ret = perf_session__cpu_bitmap(session, cpu_list, cpu_bitmap); | ||
192 | if (ret) | ||
193 | goto out_delete; | ||
194 | } | ||
195 | |||
180 | ret = perf_session__process_events(session, &event_ops); | 196 | ret = perf_session__process_events(session, &event_ops); |
181 | if (ret) | 197 | if (ret) |
182 | goto out_delete; | 198 | goto out_delete; |
@@ -201,7 +217,8 @@ static int __cmd_annotate(void) | |||
201 | total_nr_samples += nr_samples; | 217 | total_nr_samples += nr_samples; |
202 | hists__collapse_resort(hists); | 218 | hists__collapse_resort(hists); |
203 | hists__output_resort(hists); | 219 | hists__output_resort(hists); |
204 | hists__find_annotations(hists, pos->idx); | 220 | hists__find_annotations(hists, pos->idx, |
221 | session->evlist->nr_entries); | ||
205 | } | 222 | } |
206 | } | 223 | } |
207 | 224 | ||
@@ -252,6 +269,15 @@ static const struct option options[] = { | |||
252 | "print matching source lines (may be slow)"), | 269 | "print matching source lines (may be slow)"), |
253 | OPT_BOOLEAN('P', "full-paths", &full_paths, | 270 | OPT_BOOLEAN('P', "full-paths", &full_paths, |
254 | "Don't shorten the displayed pathnames"), | 271 | "Don't shorten the displayed pathnames"), |
272 | OPT_STRING('c', "cpu", &cpu_list, "cpu", "list of cpus to profile"), | ||
273 | OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory", | ||
274 | "Look for files with symbols relative to this directory"), | ||
275 | OPT_BOOLEAN(0, "source", &symbol_conf.annotate_src, | ||
276 | "Interleave source code with assembly code (default)"), | ||
277 | OPT_BOOLEAN(0, "asm-raw", &symbol_conf.annotate_asm_raw, | ||
278 | "Display raw encoding of assembly instructions (default)"), | ||
279 | OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style", | ||
280 | "Specify disassembler style (e.g. -M intel for intel syntax)"), | ||
255 | OPT_END() | 281 | OPT_END() |
256 | }; | 282 | }; |
257 | 283 | ||