aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2014-03-02 10:56:40 -0500
committerIngo Molnar <mingo@kernel.org>2014-03-11 06:57:59 -0400
commit6bedfab68666afac1b03f8d62ee037c6ab82fbc5 (patch)
tree900b063d69014b93d04abf5883cf73c729d2e98f
parent63c45f4ba533e9749da16298db53e491c25d805b (diff)
perf tools: Disable user-space callchain/stack dumps for function trace events
User space callchains and user space stack dump were disabled for function trace event. Mailing list discussions: http://marc.info/?t=139302086500001&r=1&w=2 http://marc.info/?t=139301437300003&r=1&w=2 Catching up with perf and disabling user space callchains and DWARF unwind (uses user stack dump) for function trace event. Adding following warnings when callchains are used for function trace event: # perf record -g -e ftrace:function ... Disabling user space callchains for function trace event. ... # ./perf record --call-graph=dwarf -e ftrace:function ... Cannot use DWARF unwind for function trace event, falling back to framepointers. Disabling user space callchains for function trace event. ... Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Vince Weaver <vincent.weaver@maine.edu> Cc: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1393775800-13524-4-git-send-email-jolsa@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--tools/perf/util/evsel.c41
-rw-r--r--tools/perf/util/evsel.h18
2 files changed, 48 insertions, 11 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index adc94dd1794d..26b67b11c65b 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -500,6 +500,34 @@ int perf_evsel__group_desc(struct perf_evsel *evsel, char *buf, size_t size)
500 return ret; 500 return ret;
501} 501}
502 502
503static void
504perf_evsel__config_callgraph(struct perf_evsel *evsel,
505 struct record_opts *opts)
506{
507 bool function = perf_evsel__is_function_event(evsel);
508 struct perf_event_attr *attr = &evsel->attr;
509
510 perf_evsel__set_sample_bit(evsel, CALLCHAIN);
511
512 if (opts->call_graph == CALLCHAIN_DWARF) {
513 if (!function) {
514 perf_evsel__set_sample_bit(evsel, REGS_USER);
515 perf_evsel__set_sample_bit(evsel, STACK_USER);
516 attr->sample_regs_user = PERF_REGS_MASK;
517 attr->sample_stack_user = opts->stack_dump_size;
518 attr->exclude_callchain_user = 1;
519 } else {
520 pr_info("Cannot use DWARF unwind for function trace event,"
521 " falling back to framepointers.\n");
522 }
523 }
524
525 if (function) {
526 pr_info("Disabling user space callchains for function trace event.\n");
527 attr->exclude_callchain_user = 1;
528 }
529}
530
503/* 531/*
504 * The enable_on_exec/disabled value strategy: 532 * The enable_on_exec/disabled value strategy:
505 * 533 *
@@ -595,17 +623,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
595 attr->mmap_data = track; 623 attr->mmap_data = track;
596 } 624 }
597 625
598 if (opts->call_graph_enabled) { 626 if (opts->call_graph_enabled)
599 perf_evsel__set_sample_bit(evsel, CALLCHAIN); 627 perf_evsel__config_callgraph(evsel, opts);
600
601 if (opts->call_graph == CALLCHAIN_DWARF) {
602 perf_evsel__set_sample_bit(evsel, REGS_USER);
603 perf_evsel__set_sample_bit(evsel, STACK_USER);
604 attr->sample_regs_user = PERF_REGS_MASK;
605 attr->sample_stack_user = opts->stack_dump_size;
606 attr->exclude_callchain_user = 1;
607 }
608 }
609 628
610 if (target__has_cpu(&opts->target)) 629 if (target__has_cpu(&opts->target))
611 perf_evsel__set_sample_bit(evsel, CPU); 630 perf_evsel__set_sample_bit(evsel, CPU);
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index f1b325665aae..0c9926cfb292 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -315,6 +315,24 @@ static inline bool perf_evsel__is_group_event(struct perf_evsel *evsel)
315 return perf_evsel__is_group_leader(evsel) && evsel->nr_members > 1; 315 return perf_evsel__is_group_leader(evsel) && evsel->nr_members > 1;
316} 316}
317 317
318/**
319 * perf_evsel__is_function_event - Return whether given evsel is a function
320 * trace event
321 *
322 * @evsel - evsel selector to be tested
323 *
324 * Return %true if event is function trace event
325 */
326static inline bool perf_evsel__is_function_event(struct perf_evsel *evsel)
327{
328#define FUNCTION_EVENT "ftrace:function"
329
330 return evsel->name &&
331 !strncmp(FUNCTION_EVENT, evsel->name, sizeof(FUNCTION_EVENT));
332
333#undef FUNCTION_EVENT
334}
335
318struct perf_attr_details { 336struct perf_attr_details {
319 bool freq; 337 bool freq;
320 bool verbose; 338 bool verbose;