mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@google.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	paulus@samba.org, fweisbec@gmail.com,
	perfmon2-devel@lists.sf.net, robert.richter@amd.com,
	eranian@gmail.com, davem@davemloft.net,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH] perf_events: add sampling period randomization support  (v2)
Date: Thu, 4 Mar 2010 18:34:09 -0800	[thread overview]
Message-ID: <bd4cb8901003041834l61bc510er21c9da4de8639d9b@mail.gmail.com> (raw)
In-Reply-To: <20100304211332.GA3643@elte.hu>

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.

  reply	other threads:[~2010-03-05  2:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-03  0:21 eranian
2010-03-04  8:52 ` Robert Richter
2010-03-04 11:32 ` Ingo Molnar
2010-03-04 17:25   ` Stephane Eranian
2010-03-04 21:13     ` Ingo Molnar
2010-03-05  2:34       ` Stephane Eranian [this message]
2010-03-11 11:52         ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd4cb8901003041834l61bc510er21c9da4de8639d9b@mail.gmail.com \
    --to=eranian@google.com \
    --cc=acme@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.net \
    --cc=peterz@infradead.org \
    --cc=robert.richter@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®