aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2013-11-15 01:35:50 -0500
committerIngo Molnar <mingo@kernel.org>2013-11-15 01:35:50 -0500
commit89b4be142bf2491a94af325f5206fc2f2aa18960 (patch)
tree28f5b908b42bee694cddad30d2fc1f15c66315e6 /tools/perf/util
parente310718d0e83aeb9969264dc577c45db16d9104d (diff)
parent539e6bb71e350541105e67e3d6c31392d9da25ef (diff)
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: * Synthesize anon MMAP records again, fix from Don Zickus. * Add an option in 'perf record' to force per-cpu mmaps, from Adrian Hunter. * Limit max callchain using max_stack on DWARF unwinding too. * Fix segfault in the UI browser caused by off by one handling END key. * Add '--demangle'/'--no-demangle' to perf probe, so that we can overcome current limitations in handling C++ symbols, from Azat Khuzhin . * Tweak 'perf trace' summary output, from Pekka Enberg. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/event.c6
-rw-r--r--tools/perf/util/evlist.c6
-rw-r--r--tools/perf/util/evsel.c4
-rw-r--r--tools/perf/util/evsel.h5
-rw-r--r--tools/perf/util/machine.c2
-rw-r--r--tools/perf/util/target.h1
-rw-r--r--tools/perf/util/unwind.c9
-rw-r--r--tools/perf/util/unwind.h5
8 files changed, 25 insertions, 13 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 6e3a846aed0e..bb788c109fe6 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -209,8 +209,10 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool,
209 &event->mmap.start, &event->mmap.len, prot, 209 &event->mmap.start, &event->mmap.len, prot,
210 &event->mmap.pgoff, 210 &event->mmap.pgoff,
211 execname); 211 execname);
212 212 /*
213 if (n != 5) 213 * Anon maps don't have the execname.
214 */
215 if (n < 4)
214 continue; 216 continue;
215 /* 217 /*
216 * Just like the kernel, see __perf_event_mmap in kernel/perf_event.c 218 * Just like the kernel, see __perf_event_mmap in kernel/perf_event.c
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index dc6fa3fbb180..bbc746aa5716 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -819,7 +819,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
819 if (evlist->threads == NULL) 819 if (evlist->threads == NULL)
820 return -1; 820 return -1;
821 821
822 if (target__has_task(target)) 822 if (target->force_per_cpu)
823 evlist->cpus = cpu_map__new(target->cpu_list);
824 else if (target__has_task(target))
823 evlist->cpus = cpu_map__dummy_new(); 825 evlist->cpus = cpu_map__dummy_new();
824 else if (!target__has_cpu(target) && !target->uses_mmap) 826 else if (!target__has_cpu(target) && !target->uses_mmap)
825 evlist->cpus = cpu_map__dummy_new(); 827 evlist->cpus = cpu_map__dummy_new();
@@ -1148,7 +1150,7 @@ size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp)
1148 perf_evsel__name(evsel)); 1150 perf_evsel__name(evsel));
1149 } 1151 }
1150 1152
1151 return printed + fprintf(fp, "\n");; 1153 return printed + fprintf(fp, "\n");
1152} 1154}
1153 1155
1154int perf_evlist__strerror_tp(struct perf_evlist *evlist __maybe_unused, 1156int perf_evlist__strerror_tp(struct perf_evlist *evlist __maybe_unused,
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 18f7c188ff63..46dd4c2a41ce 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -645,7 +645,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
645 } 645 }
646 } 646 }
647 647
648 if (target__has_cpu(&opts->target)) 648 if (target__has_cpu(&opts->target) || opts->target.force_per_cpu)
649 perf_evsel__set_sample_bit(evsel, CPU); 649 perf_evsel__set_sample_bit(evsel, CPU);
650 650
651 if (opts->period) 651 if (opts->period)
@@ -653,7 +653,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
653 653
654 if (!perf_missing_features.sample_id_all && 654 if (!perf_missing_features.sample_id_all &&
655 (opts->sample_time || !opts->no_inherit || 655 (opts->sample_time || !opts->no_inherit ||
656 target__has_cpu(&opts->target))) 656 target__has_cpu(&opts->target) || opts->target.force_per_cpu))
657 perf_evsel__set_sample_bit(evsel, TIME); 657 perf_evsel__set_sample_bit(evsel, TIME);
658 658
659 if (opts->raw_samples) { 659 if (opts->raw_samples) {
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index f5029653dcd7..1ea7c92e6e33 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -279,6 +279,11 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel)
279 return list_entry(evsel->node.next, struct perf_evsel, node); 279 return list_entry(evsel->node.next, struct perf_evsel, node);
280} 280}
281 281
282static inline struct perf_evsel *perf_evsel__prev(struct perf_evsel *evsel)
283{
284 return list_entry(evsel->node.prev, struct perf_evsel, node);
285}
286
282/** 287/**
283 * perf_evsel__is_group_leader - Return whether given evsel is a leader event 288 * perf_evsel__is_group_leader - Return whether given evsel is a leader event
284 * 289 *
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 0393912d8033..84cdb072ac83 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1368,7 +1368,7 @@ int machine__resolve_callchain(struct machine *machine,
1368 1368
1369 return unwind__get_entries(unwind_entry, &callchain_cursor, machine, 1369 return unwind__get_entries(unwind_entry, &callchain_cursor, machine,
1370 thread, evsel->attr.sample_regs_user, 1370 thread, evsel->attr.sample_regs_user,
1371 sample); 1371 sample, max_stack);
1372 1372
1373} 1373}
1374 1374
diff --git a/tools/perf/util/target.h b/tools/perf/util/target.h
index 89bab7129de4..2d0c50690892 100644
--- a/tools/perf/util/target.h
+++ b/tools/perf/util/target.h
@@ -12,6 +12,7 @@ struct target {
12 uid_t uid; 12 uid_t uid;
13 bool system_wide; 13 bool system_wide;
14 bool uses_mmap; 14 bool uses_mmap;
15 bool force_per_cpu;
15}; 16};
16 17
17enum target_errno { 18enum target_errno {
diff --git a/tools/perf/util/unwind.c b/tools/perf/util/unwind.c
index 5390d0b8862a..0efd5393de85 100644
--- a/tools/perf/util/unwind.c
+++ b/tools/perf/util/unwind.c
@@ -559,7 +559,7 @@ static unw_accessors_t accessors = {
559}; 559};
560 560
561static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, 561static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
562 void *arg) 562 void *arg, int max_stack)
563{ 563{
564 unw_addr_space_t addr_space; 564 unw_addr_space_t addr_space;
565 unw_cursor_t c; 565 unw_cursor_t c;
@@ -575,7 +575,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
575 if (ret) 575 if (ret)
576 display_error(ret); 576 display_error(ret);
577 577
578 while (!ret && (unw_step(&c) > 0)) { 578 while (!ret && (unw_step(&c) > 0) && max_stack--) {
579 unw_word_t ip; 579 unw_word_t ip;
580 580
581 unw_get_reg(&c, UNW_REG_IP, &ip); 581 unw_get_reg(&c, UNW_REG_IP, &ip);
@@ -588,7 +588,8 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
588 588
589int unwind__get_entries(unwind_entry_cb_t cb, void *arg, 589int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
590 struct machine *machine, struct thread *thread, 590 struct machine *machine, struct thread *thread,
591 u64 sample_uregs, struct perf_sample *data) 591 u64 sample_uregs, struct perf_sample *data,
592 int max_stack)
592{ 593{
593 unw_word_t ip; 594 unw_word_t ip;
594 struct unwind_info ui = { 595 struct unwind_info ui = {
@@ -610,5 +611,5 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
610 if (ret) 611 if (ret)
611 return -ENOMEM; 612 return -ENOMEM;
612 613
613 return get_entries(&ui, cb, arg); 614 return get_entries(&ui, cb, arg, max_stack);
614} 615}
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index ec0c71a2ca2e..d5966f49e22c 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -18,7 +18,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
18 struct machine *machine, 18 struct machine *machine,
19 struct thread *thread, 19 struct thread *thread,
20 u64 sample_uregs, 20 u64 sample_uregs,
21 struct perf_sample *data); 21 struct perf_sample *data, int max_stack);
22int unwind__arch_reg_id(int regnum); 22int unwind__arch_reg_id(int regnum);
23#else 23#else
24static inline int 24static inline int
@@ -27,7 +27,8 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
27 struct machine *machine __maybe_unused, 27 struct machine *machine __maybe_unused,
28 struct thread *thread __maybe_unused, 28 struct thread *thread __maybe_unused,
29 u64 sample_uregs __maybe_unused, 29 u64 sample_uregs __maybe_unused,
30 struct perf_sample *data __maybe_unused) 30 struct perf_sample *data __maybe_unused,
31 int max_stack __maybe_unused)
31{ 32{
32 return 0; 33 return 0;
33} 34}