Re: [PATCH] perf_events: add sampling period randomization support

From: Peter Zijlstra
Date: Tue Mar 02 2010 - 06:41:27 EST


On Tue, 2010-03-02 at 11:53 +0100, Robert Richter wrote:
>
> Only adding the random value will lead to longer sample periods on
> average. To compensate this you could calculate something like:
>
> event->hw.sample_period = event->attr.sample_period + (new_seed & mask) - (mask >> 1);

Or cheat and do something like:

sample_period ^= (new_seed & mask);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/