Re: [PATCH] perf_events: add sampling period randomization support (v2)

From: Stephane Eranian
Date: Thu Mar 04 2010 - 12:26:07 EST

On Thu, Mar 4, 2010 at 3:32 AM, Ingo Molnar <mingo@xxxxxxx> wrote:
> * eranian@xxxxxxxxxx <eranian@xxxxxxxxxx> wrote:
>> This patch adds support for randomizing the sampling period. ÂRandomization
>> is very useful to mitigate the bias that exists with sampling. The random
>> number generator does not need to be sophisticated. This patch uses the
>> builtin random32() generator.
>> + Â Â if (width > 63 || attr->freq)
>> + Â Â Â Â Â Â return -EINVAL;
> Why not for freq counters? Those are semi-randomized already, but it might
> make sense to make them 'more' randomized in special circumstances. That would
> also allow us to enable the randomization in perf top and perf record, by
> default.
What's the goal of freq?
Achieve and maintain the target interrupt/rate.
In doing so, it has to adjust the period (not randomly).

Randomization may prevent achieving the rate, or it may slow
it down. What's the value add of that?

> Without that we'd have no immediate usecase and no way to ensure that this
> code works as intended.
With perf you also have fixed sampling period (-c option), you simply need to
express the fact you want it randomized.

> Thanks,
> Â Â Â ÂIngo

Stephane Eranian | EMEA Software Engineering
Google France | 38 avenue de l'OpÃra | 75002 Paris
Tel : +33 (0) 1 42 68 53 00
This email may be confidential or privileged. If you received this
communication by mistake, please
don't forward it to anyone else, please erase all copies and
attachments, and please let me know that
it went to the wrong person. Thanks
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