diff options
author | Stanislav Fomichev <stfomichev@yandex-team.ru> | 2014-07-08 14:05:16 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-08 14:34:40 -0400 |
commit | a2ea67d7b5618c868c1fe15a50af71b858d36887 (patch) | |
tree | c795d3a8a7b3e8ecfa48f7ccbef0e5cd31d17370 /tools | |
parent | 071266bf5b6a4f41250d2b26b000f1d2f9620afe (diff) |
perf trace: Add pagefault statistics
'perf trace' can show summary of events using -S option. This commit
also reports number of major/minor pagefault events in this summary.
$ perf trace -s --pf all -- sleep 1
Summary of events:
sleep (18604), 275 events, 99.6%, 197 minfaults, 0.000 msec
syscall calls min avg max stddev
(msec) (msec) (msec) (%)
--------------- -------- --------- --------- --------- ------
read 2 0.000 0.001 0.002 100.00%
open 3 0.004 0.005 0.007 21.13%
close 3 0.001 0.001 0.001 1.37%
fstat 3 0.001 0.002 0.002 10.66%
mmap 8 0.002 0.004 0.006 10.69%
mprotect 4 0.003 0.005 0.008 24.68%
munmap 1 0.005 0.005 0.005 0.00%
brk 3 0.001 0.002 0.003 28.08%
access 3 0.002 0.003 0.005 24.48%
nanosleep 1 1000.747 1000.747 1000.747 0.00%
execve 8 0.000 0.033 0.246 91.00%
arch_prctl 1 0.001 0.001 0.001 0.00%
Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1404842716-19190-1-git-send-email-stfomichev@yandex-team.ru
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-trace.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index dc7a694b61fe..b94dffc5fa85 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -1133,6 +1133,7 @@ struct thread_trace { | |||
1133 | u64 exit_time; | 1133 | u64 exit_time; |
1134 | bool entry_pending; | 1134 | bool entry_pending; |
1135 | unsigned long nr_events; | 1135 | unsigned long nr_events; |
1136 | unsigned long pfmaj, pfmin; | ||
1136 | char *entry_str; | 1137 | char *entry_str; |
1137 | double runtime_ms; | 1138 | double runtime_ms; |
1138 | struct { | 1139 | struct { |
@@ -1804,8 +1805,20 @@ static int trace__pgfault(struct trace *trace, | |||
1804 | u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; | 1805 | u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; |
1805 | struct addr_location al; | 1806 | struct addr_location al; |
1806 | char map_type = 'd'; | 1807 | char map_type = 'd'; |
1808 | struct thread_trace *ttrace; | ||
1807 | 1809 | ||
1808 | thread = machine__findnew_thread(trace->host, sample->pid, sample->tid); | 1810 | thread = machine__findnew_thread(trace->host, sample->pid, sample->tid); |
1811 | ttrace = thread__trace(thread, trace->output); | ||
1812 | if (ttrace == NULL) | ||
1813 | return -1; | ||
1814 | |||
1815 | if (evsel->attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ) | ||
1816 | ttrace->pfmaj++; | ||
1817 | else | ||
1818 | ttrace->pfmin++; | ||
1819 | |||
1820 | if (trace->summary_only) | ||
1821 | return 0; | ||
1809 | 1822 | ||
1810 | thread__find_addr_location(thread, trace->host, cpumode, MAP__FUNCTION, | 1823 | thread__find_addr_location(thread, trace->host, cpumode, MAP__FUNCTION, |
1811 | sample->ip, &al); | 1824 | sample->ip, &al); |
@@ -2346,6 +2359,10 @@ static int trace__fprintf_one_thread(struct thread *thread, void *priv) | |||
2346 | printed += fprintf(fp, " %s (%d), ", thread__comm_str(thread), thread->tid); | 2359 | printed += fprintf(fp, " %s (%d), ", thread__comm_str(thread), thread->tid); |
2347 | printed += fprintf(fp, "%lu events, ", ttrace->nr_events); | 2360 | printed += fprintf(fp, "%lu events, ", ttrace->nr_events); |
2348 | printed += fprintf(fp, "%.1f%%", ratio); | 2361 | printed += fprintf(fp, "%.1f%%", ratio); |
2362 | if (ttrace->pfmaj) | ||
2363 | printed += fprintf(fp, ", %lu majfaults", ttrace->pfmaj); | ||
2364 | if (ttrace->pfmin) | ||
2365 | printed += fprintf(fp, ", %lu minfaults", ttrace->pfmin); | ||
2349 | printed += fprintf(fp, ", %.3f msec\n", ttrace->runtime_ms); | 2366 | printed += fprintf(fp, ", %.3f msec\n", ttrace->runtime_ms); |
2350 | printed += thread__dump_stats(ttrace, trace, fp); | 2367 | printed += thread__dump_stats(ttrace, trace, fp); |
2351 | 2368 | ||