* [PATCH] perf trace: add pagefault statistics
@ 2014-07-08 18:05 Stanislav Fomichev
2014-07-08 18:42 ` Arnaldo Carvalho de Melo
2014-07-16 19:17 ` [tip:perf/core] perf trace: Add " tip-bot for Stanislav Fomichev
0 siblings, 2 replies; 3+ messages in thread
From: Stanislav Fomichev @ 2014-07-08 18:05 UTC (permalink / raw)
To: a.p.zijlstra, paulus, mingo, acme, dsahern, stfomichev; +Cc: linux-kernel
'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>
---
tools/perf/builtin-trace.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
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 {
u64 exit_time;
bool entry_pending;
unsigned long nr_events;
+ unsigned long pfmaj, pfmin;
char *entry_str;
double runtime_ms;
struct {
@@ -1804,8 +1805,20 @@ static int trace__pgfault(struct trace *trace,
u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
struct addr_location al;
char map_type = 'd';
+ struct thread_trace *ttrace;
thread = machine__findnew_thread(trace->host, sample->pid, sample->tid);
+ ttrace = thread__trace(thread, trace->output);
+ if (ttrace == NULL)
+ return -1;
+
+ if (evsel->attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ)
+ ttrace->pfmaj++;
+ else
+ ttrace->pfmin++;
+
+ if (trace->summary_only)
+ return 0;
thread__find_addr_location(thread, trace->host, cpumode, MAP__FUNCTION,
sample->ip, &al);
@@ -2346,6 +2359,10 @@ static int trace__fprintf_one_thread(struct thread *thread, void *priv)
printed += fprintf(fp, " %s (%d), ", thread__comm_str(thread), thread->tid);
printed += fprintf(fp, "%lu events, ", ttrace->nr_events);
printed += fprintf(fp, "%.1f%%", ratio);
+ if (ttrace->pfmaj)
+ printed += fprintf(fp, ", %lu majfaults", ttrace->pfmaj);
+ if (ttrace->pfmin)
+ printed += fprintf(fp, ", %lu minfaults", ttrace->pfmin);
printed += fprintf(fp, ", %.3f msec\n", ttrace->runtime_ms);
printed += thread__dump_stats(ttrace, trace, fp);
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf trace: add pagefault statistics
2014-07-08 18:05 [PATCH] perf trace: add pagefault statistics Stanislav Fomichev
@ 2014-07-08 18:42 ` Arnaldo Carvalho de Melo
2014-07-16 19:17 ` [tip:perf/core] perf trace: Add " tip-bot for Stanislav Fomichev
1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2014-07-08 18:42 UTC (permalink / raw)
To: Stanislav Fomichev; +Cc: a.p.zijlstra, paulus, mingo, dsahern, linux-kernel
Em Tue, Jul 08, 2014 at 10:05:16PM +0400, Stanislav Fomichev escreveu:
> '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
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/core] perf trace: Add pagefault statistics
2014-07-08 18:05 [PATCH] perf trace: add pagefault statistics Stanislav Fomichev
2014-07-08 18:42 ` Arnaldo Carvalho de Melo
@ 2014-07-16 19:17 ` tip-bot for Stanislav Fomichev
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Stanislav Fomichev @ 2014-07-16 19:17 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, mingo, hpa, mingo, a.p.zijlstra,
stfomichev, dsahern, tglx
Commit-ID: a2ea67d7b5618c868c1fe15a50af71b858d36887
Gitweb: http://git.kernel.org/tip/a2ea67d7b5618c868c1fe15a50af71b858d36887
Author: Stanislav Fomichev <stfomichev@yandex-team.ru>
AuthorDate: Tue, 8 Jul 2014 22:05:16 +0400
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 8 Jul 2014 15:34:40 -0300
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>
---
tools/perf/builtin-trace.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index dc7a694..b94dffc 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1133,6 +1133,7 @@ struct thread_trace {
u64 exit_time;
bool entry_pending;
unsigned long nr_events;
+ unsigned long pfmaj, pfmin;
char *entry_str;
double runtime_ms;
struct {
@@ -1804,8 +1805,20 @@ static int trace__pgfault(struct trace *trace,
u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
struct addr_location al;
char map_type = 'd';
+ struct thread_trace *ttrace;
thread = machine__findnew_thread(trace->host, sample->pid, sample->tid);
+ ttrace = thread__trace(thread, trace->output);
+ if (ttrace == NULL)
+ return -1;
+
+ if (evsel->attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ)
+ ttrace->pfmaj++;
+ else
+ ttrace->pfmin++;
+
+ if (trace->summary_only)
+ return 0;
thread__find_addr_location(thread, trace->host, cpumode, MAP__FUNCTION,
sample->ip, &al);
@@ -2346,6 +2359,10 @@ static int trace__fprintf_one_thread(struct thread *thread, void *priv)
printed += fprintf(fp, " %s (%d), ", thread__comm_str(thread), thread->tid);
printed += fprintf(fp, "%lu events, ", ttrace->nr_events);
printed += fprintf(fp, "%.1f%%", ratio);
+ if (ttrace->pfmaj)
+ printed += fprintf(fp, ", %lu majfaults", ttrace->pfmaj);
+ if (ttrace->pfmin)
+ printed += fprintf(fp, ", %lu minfaults", ttrace->pfmin);
printed += fprintf(fp, ", %.3f msec\n", ttrace->runtime_ms);
printed += thread__dump_stats(ttrace, trace, fp);
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-16 19:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-08 18:05 [PATCH] perf trace: add pagefault statistics Stanislav Fomichev
2014-07-08 18:42 ` Arnaldo Carvalho de Melo
2014-07-16 19:17 ` [tip:perf/core] perf trace: Add " tip-bot for Stanislav Fomichev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.