aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-15 05:24:38 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-15 09:58:03 -0400
commit3dfabc74c65904c9e6cf952391312d16ea772ef5 (patch)
treee9b42a66aa6913cd811c0157aee521fc84b055ec /tools/perf/builtin-report.c
parent74193ef0ecab92535c8517f082f1f50504526c9b (diff)
perf report: Add per system call overhead histogram
Take advantage of call-graph percounter sampling/recording to display a non-trivial histogram: the true, collapsed/summarized cost measurement, on a per system call total overhead basis: aldebaran:~/linux/linux/tools/perf> ./perf record -g -a -f ~/hackbench 10 aldebaran:~/linux/linux/tools/perf> ./perf report -s symbol --syscalls | head -10 # # (3536 samples) # # Overhead Symbol # ........ ...... # 40.75% [k] sys_write 40.21% [k] sys_read 4.44% [k] do_nmi ... This is done by accounting each (reliable) call-chain that chains back to a given system call to that system call function. [ So in the above example we can see that hackbench spends about 40% of its total time somewhere in sys_write() and 40% somewhere in sys_read(), the rest of the time is spent in user-space. The time is not spent in sys_write() _itself_ but in one of its many child functions. ] Or, a recording of a (source files are already in the page-cache) kernel build: $ perf record -g -m 512 -f -- make -j32 kernel $ perf report -s s --syscalls | grep '\[k\]' | grep -v nmi 4.14% [k] do_page_fault 1.20% [k] sys_write 1.10% [k] sys_open 0.63% [k] sys_exit_group 0.48% [k] smp_apic_timer_interrupt 0.37% [k] sys_read 0.37% [k] sys_execve 0.20% [k] sys_mmap 0.18% [k] sys_close 0.14% [k] sys_munmap 0.13% [k] sys_poll 0.09% [k] sys_newstat 0.07% [k] sys_clone 0.06% [k] sys_newfstat 0.05% [k] sys_access 0.05% [k] schedule Shows the true total cost of each syscall variant that gets used during a kernel build. This profile reveals it that pagefaults are the costliest, followed by read()/write(). An interesting detail: timer interrupts cost 0.5% - or 0.5 seconds per 100 seconds of kernel build-time. (this was done with HZ=1000) The summary is done in 'perf report', i.e. in the post-processing stage - so once we have a good call-graph recording, this type of non-trivial high-level analysis becomes possible. 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> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Pekka Enberg <penberg@cs.helsinki.fi> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index aebba5659345..1e2f5dde312c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -40,6 +40,7 @@ static int dump_trace = 0;
40 40
41static int verbose; 41static int verbose;
42static int full_paths; 42static int full_paths;
43static int collapse_syscalls;
43 44
44static unsigned long page_size; 45static unsigned long page_size;
45static unsigned long mmap_window = 32; 46static unsigned long mmap_window = 32;
@@ -983,6 +984,15 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
983 for (i = 0; i < chain->nr; i++) 984 for (i = 0; i < chain->nr; i++)
984 dprintf("..... %2d: %p\n", i, (void *)chain->ips[i]); 985 dprintf("..... %2d: %p\n", i, (void *)chain->ips[i]);
985 } 986 }
987 if (collapse_syscalls) {
988 /*
989 * Find the all-but-last kernel entry
990 * amongst the call-chains - to get
991 * to the level of system calls:
992 */
993 if (chain->kernel >= 2)
994 ip = chain->ips[chain->kernel-2];
995 }
986 } 996 }
987 997
988 dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid); 998 dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
@@ -1343,6 +1353,8 @@ static const struct option options[] = {
1343 "sort by key(s): pid, comm, dso, symbol. Default: pid,symbol"), 1353 "sort by key(s): pid, comm, dso, symbol. Default: pid,symbol"),
1344 OPT_BOOLEAN('P', "full-paths", &full_paths, 1354 OPT_BOOLEAN('P', "full-paths", &full_paths,
1345 "Don't shorten the pathnames taking into account the cwd"), 1355 "Don't shorten the pathnames taking into account the cwd"),
1356 OPT_BOOLEAN('S', "syscalls", &collapse_syscalls,
1357 "show per syscall summary overhead, using call graph"),
1346 OPT_END() 1358 OPT_END()
1347}; 1359};
1348 1360