From: Ingo Molnar <mingo@elte.hu>
To: Vince Weaver <vince@deater.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>,
linux-kernel@vger.kernel.org, Mike Galbraith <efault@gmx.de>
Subject: [numbers] perfmon/pfmon overhead of 17%-94%
Date: Sat, 27 Jun 2009 08:44:04 +0200 [thread overview]
Message-ID: <20090627064404.GA19368@elte.hu> (raw)
In-Reply-To: <20090627060432.GB16200@elte.hu>
* Ingo Molnar <mingo@elte.hu> wrote:
> Besides, you compare perfcounters to perfmon (which you seem to be
> a contributor of), while in reality perfmon has much, much worse
> (and unfixable, because designed-in) measurement overhead.
>
> So why are you criticising perfcounters for a 5000 cycles
> measurement overhead while perfmon has huge, _hundreds of
> millions_ of cycles measurement overhead (per second) for various
> realistic workloads? [ In fact in one of the scheduler-tests
> perfmon has a whopping measurement overhead of _nine billion_
> cycles, it increased total runtime of the workload from 3.3
> seconds to 6.6 seconds. (!) ]
Here are the more detailed perfmon/pfmon measurement overhead
numbers.
Test system is a "Intel Core2 E6800 @ 2.93GHz", 1 GB of RAM, default
Fedora install.
I've measured two workloads:
hackbench.c # messaging server benchmark
test-1m-pipes.c # does 1 million pipe ops, similar to lat_pipe
v2.6.28+perfmon patches (v3, full):
./hackbench 10
0.496400985 seconds time elapsed ( +- 1.699% )
pfmon --follow-fork--aggregate-results ./hackbench 10
0.580812999 seconds time elapsed ( +- 2.233% )
I.e. this workload runs 17% slower under pfmon, the measurement
overhead is about 1.45 billion cycles.
Furthermore, when running a 'pipe latency benchmark', an app that
does one million pipe reads and writes between two tasks (source
code attached below), i measured the following perfmon/pfmon
overhead:
./pipe-test-1m
3.344280347 seconds time elapsed ( +- 0.361% )
pfmon --follow-fork --aggregate-results ./pipe-test-1m
6.508737983 seconds time elapsed ( +- 0.243% )
That's an about 94% measurement overhead, or about 9.2 _billion_
cycles overhead on this test-system.
These perfmon/pfmon overhead figures are consistently reproducible,
and they happen on other test-systems as well, and with other
workloads as well. Basically for any app that involves task creation
or context-switching, perfmon adds considerable runtime overhead -
well beyond the overhead of perfcounters.
Ingo
-----------------{ pipe-test-1m.c }-------------------->
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/wait.h>
#include <linux/unistd.h>
#define LOOPS 1000000
int main (void)
{
unsigned long long t0, t1;
int pipe_1[2], pipe_2[2];
int m = 0, i;
pipe(pipe_1);
pipe(pipe_2);
if (!fork()) {
for (i = 0; i < LOOPS; i++) {
read(pipe_1[0], &m, sizeof(int));
write(pipe_2[1], &m, sizeof(int));
}
} else {
for (i = 0; i < LOOPS; i++) {
write(pipe_1[1], &m, sizeof(int));
read(pipe_2[0], &m, sizeof(int));
}
}
return 0;
}
next prev parent reply other threads:[~2009-06-27 6:44 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-24 13:59 performance counter 20% error finding retired instruction count Vince Weaver
2009-06-24 15:10 ` Ingo Molnar
2009-06-25 2:12 ` Vince Weaver
2009-06-25 6:50 ` Peter Zijlstra
2009-06-25 9:13 ` Ingo Molnar
2009-06-26 18:22 ` Vince Weaver
2009-06-26 19:12 ` Peter Zijlstra
2009-06-27 5:32 ` Ingo Molnar
2009-06-26 19:23 ` Vince Weaver
2009-06-27 6:04 ` performance counter ~0.4% " Ingo Molnar
2009-06-27 6:44 ` Ingo Molnar [this message]
2009-06-29 18:25 ` [numbers] perfmon/pfmon overhead of 17%-94% Vince Weaver
2009-06-29 21:02 ` Ingo Molnar
2009-07-02 21:07 ` Vince Weaver
2009-07-03 7:58 ` Ingo Molnar
2009-07-03 21:43 ` Vince Weaver
2009-07-03 18:31 ` Andi Kleen
2009-07-03 21:25 ` Vince Weaver
2009-07-03 23:40 ` Andi Kleen
2009-06-29 23:46 ` [patch] perf_counter: Add enable-on-exec attribute Ingo Molnar
2009-06-29 23:55 ` [numbers] perfmon/pfmon overhead of 17%-94% Ingo Molnar
2009-06-30 0:05 ` Ingo Molnar
2009-06-27 6:48 ` performance counter ~0.4% error finding retired instruction count Paul Mackerras
2009-06-27 17:28 ` Ingo Molnar
2009-06-29 2:12 ` Paul Mackerras
2009-06-29 2:13 ` Paul Mackerras
2009-06-29 3:48 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090627064404.GA19368@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=vince@deater.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox