Re: Getting interrupt every million cache misses

From: Peter Zijlstra
Date: Thu Oct 27 2016 - 11:19:33 EST


On Wed, Oct 26, 2016 at 10:54:16PM +0200, Pavel Machek wrote:
> Hi!
>
> I'd like to get an interrupt every million cache misses... to do a
> printk() or something like that. As far as I can tell, modern hardware
> should allow me to do that. AFAICT performance events subsystem can do
> something like that, but I can't figure out where the code is / what I
> should call.
>
> Can someone help?

Can you go back one step and explain why you would want this? What use
is a printk() on every 1e6-th cache miss.

That is, why doesn't:

$ perf record -e cache-misses -c 1000000 -a -- sleep 5

suffice?