aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-14 09:04:15 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-14 14:34:06 -0400
commit3efa1cc99ec51bc7a7ae0011a16619fd20dbe6ea (patch)
treedb39c3b638bdaaf65382147c55a6cb60b12b9cbd /tools/perf/builtin-record.c
parent8465b05046652cfde3d47692cab2e8ba962f140f (diff)
perf record/report: Add call graph / call chain profiling
Add the first steps of call-graph profiling: - add the -c (--call-graph) option to perf record - parse the call-graph record and printout out under -D (--dump-trace) The call-graph data is not put into the histogram yet, but it can be seen that it's being processed correctly: 0x3ce0 [0x38]: event: 35 . . ... raw event: size 56 bytes . 0000: 23 00 00 00 05 00 38 00 d4 df 0e 81 ff ff ff ff #.....8........ . 0010: 60 0b 00 00 60 0b 00 00 03 00 00 00 01 00 02 00 `...`.......... . 0020: d4 df 0e 81 ff ff ff ff a0 61 ed 41 36 00 00 00 .........a.A6.. . 0030: 04 92 e6 41 36 00 00 00 .a.A6.. . 0x3ce0 [0x38]: PERF_EVENT (IP, 5): 2912: 0xffffffff810edfd4 period: 1 ... chain: u:2, k:1, nr:3 ..... 0: 0xffffffff810edfd4 ..... 1: 0x3641ed61a0 ..... 2: 0x3641e69204 ... thread: perf:2912 ...... dso: [kernel] This shows a 3-entry call-graph: with 1 kernel-space and two user-space entries Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Arjan van de Ven <arjan@infradead.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 0f5771f615da..a177a591b52c 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -37,6 +37,7 @@ static pid_t target_pid = -1;
37static int inherit = 1; 37static int inherit = 1;
38static int force = 0; 38static int force = 0;
39static int append_file = 0; 39static int append_file = 0;
40static int call_graph = 0;
40static int verbose = 0; 41static int verbose = 0;
41 42
42static long samples; 43static long samples;
@@ -351,11 +352,16 @@ static void create_counter(int counter, int cpu, pid_t pid)
351 int track = 1; 352 int track = 1;
352 353
353 attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID; 354 attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
355
354 if (freq) { 356 if (freq) {
355 attr->sample_type |= PERF_SAMPLE_PERIOD; 357 attr->sample_type |= PERF_SAMPLE_PERIOD;
356 attr->freq = 1; 358 attr->freq = 1;
357 attr->sample_freq = freq; 359 attr->sample_freq = freq;
358 } 360 }
361
362 if (call_graph)
363 attr->sample_type |= PERF_SAMPLE_CALLCHAIN;
364
359 attr->mmap = track; 365 attr->mmap = track;
360 attr->comm = track; 366 attr->comm = track;
361 attr->inherit = (cpu < 0) && inherit; 367 attr->inherit = (cpu < 0) && inherit;
@@ -555,6 +561,8 @@ static const struct option options[] = {
555 "profile at this frequency"), 561 "profile at this frequency"),
556 OPT_INTEGER('m', "mmap-pages", &mmap_pages, 562 OPT_INTEGER('m', "mmap-pages", &mmap_pages,
557 "number of mmap data pages"), 563 "number of mmap data pages"),
564 OPT_BOOLEAN('g', "call-graph", &call_graph,
565 "do call-graph (stack chain/backtrace) recording"),
558 OPT_BOOLEAN('v', "verbose", &verbose, 566 OPT_BOOLEAN('v', "verbose", &verbose,
559 "be more verbose (show counter open errors, etc)"), 567 "be more verbose (show counter open errors, etc)"),
560 OPT_END() 568 OPT_END()