Messages in this thread | | | Date | Wed, 19 Jun 2013 19:51:39 +0200 | From | Oleg Nesterov <> | Subject | Re: [PATCH 0/3] tracing/perf: perf_trace_buf/perf_xxx hacks. |
| |
On 06/19, Oleg Nesterov wrote: > > On 06/19, Peter Zijlstra wrote: > > > > I'm probably missing something obviuos, but what are we trying to do? > > Say, "perf record -e sched:sched_switch -p1". > > Every task except /sbin/init will do perf_trace_sched_switch() and > perf_trace_buf_prepare() + perf_trace_buf_submit for no reason(), > it doesn't have a counter.
I did some testing under kvm, not sure these numbers actually mean something, but still.
So, the test-case:
int pipe1[2], pipe2[2];
void *tfunc(void *arg) { for (;;) { char c; assert(read(pipe1[0], &c, 1) == 1); assert(write(pipe2[1], &c, 1) == 1); } }
int main(void) { pthread_t thr; int nr;
assert(pipe(pipe1) == 0); assert(pipe(pipe2) == 0);
assert(pthread_create(&thr, NULL, tfunc, NULL) == 0);
for (nr = 0; nr < 1000 * 1000; ++nr) { char c;
assert(write(pipe1[1], &c, 1) == 1); assert(read(pipe2[0], &c, 1) == 1); }
return 0; }
Idle machine, "/usr/bin/time -f "%e %S %U" taskset 1 ./pf" 3 times:
20.73 20.05 0.66 20.68 20.04 0.63 20.68 20.02 0.65
Now with "perf record -e sched:sched_switch -p1" running,
before 3/3:
21.59 20.77 0.80 21.40 20.70 0.68 21.50 20.72 0.78
after 3/3:
21.00 20.23 0.76 20.89 20.19 0.69 20.94 20.26 0.66
Oleg.
| |