diff options
author | Paul Mackerras <paulus@samba.org> | 2009-06-29 21:13:21 +1000 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-29 22:38:09 +0200 |
commit | 051ae7f7344f453616b6b10332d4d8e1d40ed823 (patch) | |
tree | 7d03f94c0a219b52fa604358c2ed835c1c861b35 /kernel/utsname_sysctl.c | |
parent | 210ad39fb7ef0bc0494483f517f42524f16bb2a7 (diff) |
perf_counter tools: Reduce perf stat measurement overhead/skew
Vince Weaver reported a 'perf stat' measurement overhead in the
count of retired instructions, which can amount to a +6000
instructions inflated count in the reported count.
At present, perf stat creates its counters on the perf process. Thus
the counters count the fork and various other activity in both the
parent and child, such as the resolver overhead for resolving PLT
entries for any libc functions that haven't been called before, such
as execvp.
This reduces the overhead by creating the counters on the child process
after the fork, using a couple of pipes to synchronize so that the
child process waits until the parent has created the counters before
doing the exec. To eliminate the PLT resolution overhead on calling
execvp, this does a dummy execvp first which will always fail.
With this, the overhead of executing a program goes down from over
4800 instructions to about 90 instructions on powerpc (32-bit).
This was measured with a statically-linked program written in
assembler which only does the 3 instructions needed to call _exit(0).
Before:
$ perf stat -e 0:1:u ./three
Performance counter stats for './three':
4858 instructions
0.001274523 seconds time elapsed
After:
$ perf stat -e 0:1:u ./three
Performance counter stats for './three':
92 instructions
0.000468153 seconds time elapsed
Reported-by: Vince Weaver <vince@deater.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <19016.41425.814043.870352@cargo.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/utsname_sysctl.c')
0 files changed, 0 insertions, 0 deletions