Re: [patch 0/3] [Announcement] Performance Counters for Linux

From: Ingo Molnar
Date: Fri Dec 05 2008 - 03:19:14 EST

* David Miller <davem@xxxxxxxxxxxxx> wrote:

> From: Ingo Molnar <mingo@xxxxxxx>
> Date: Fri, 5 Dec 2008 08:03:29 +0100
> >
> > * Ingo Molnar <mingo@xxxxxxx> wrote:
> >
> > > This can be done in a very natural way with our abstraction, and the
> > > "hello.c" example happens to do exactly that:
> >
> > multiple people pointed out that we have not posted hello.c :-/
> Because it's completely not providing the facility. This is not how
> people want to use the performance counters at all.
> And it doesn't even do what Paulus said is necessary, he said:
> --------------------
> > One thing that this sort of thing can't do is to get values from
> > multiple counters that correlate with each other. For instance, we
> > would often want to count, say, L2 cache misses and instructions
> > completed at the same time, and be able to read both counters at very
> > close to the same time, so that we can measure average L2 cache misses
> > per instruction completed, which is useful.
> --------------------
> And if you read one counter then read the other as seperate operations,
> you get extra events in there as a side effect of going back into
> userspace between the two reads.

that's wrong. If you _want_ to measure in a different context, with as
little measurement impact as possible, you can do it with our code. The
announcement provides the example for that.

For example, i just started this bash infinite loop:

$ while :; do :; done &
[1] 1877

$ ./monitor -e 1 -c 1000000000 1877
IP: 0x00000031a2e70d4b
IP: 0x0000000000455f64
IP: 0x00000031a2f028a0
IP: 0x0000000000440692
IP: 0x0000000000441b8e
IP: 0x00000031a2e6f630
IP: 0x0000000000446129
IP: 0x00000031a2e6edbc
IP: 0x0000000000443736
IP: 0x0000000000441c80
IP: 0x000000000043913a

We get IP readouts every 1 billion instructions executed in that shell.
That shell is never stopped or otherwise intruded - it's kept as an as
pristine of an execution environment as possible.

Furthermore, the event readouts strictly only include event counts of the
shell PID, _not_ of the monitor context's read() or other activities.

> Nobody wants that, [...]

Nobody wants that and we dont do it.

Really, you should take a more serious look at our code.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at