lkml.org 
[lkml]   [2010]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] perf_events: add sampling period randomization support (v2)
From
On Thu, Mar 4, 2010 at 1:13 PM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Stephane Eranian <eranian@google.com> wrote:
>
>> On Thu, Mar 4, 2010 at 3:32 AM, Ingo Molnar <mingo@elte.hu> wrote:
>> >
>> > * eranian@google.com <eranian@google.com> 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).
>
> No, the goal of auto-freq is to keep a steady average rate of sampling.
>
rate of samples = rate of interrupts (if period < 32 bits on Intel).

> There is no requirement to keep it 'steady' - each sample comes with a
> specific weight.
>
>> Randomization may prevent achieving the rate, or it may slow
>> it down. What's the value add of that?
>
> Why do you assume that the two are incompatible? We can randomize auto-freq
> and still have a perfectly stable average rate.
>
What would that buy you compared to what you already have?

> We know how long each sample takes so the result is precise, via
> PERF_SAMPLE_PERIOD.
>
I understand that.

> -c is legacy in essence. The default is auto-freq and i doubt anyone uses -c
> anymore.
>
The -c option may be more convenient when not counting events correlated with
time.


\
 
 \ /
  Last update: 2010-03-05 03:37    [W:0.085 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site