[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20100302141824.GG13205@erda.amd.com>
Date: Tue, 2 Mar 2010 15:18:24 +0100
From: Robert Richter <robert.richter@....com>
To: Peter Zijlstra <peterz@...radead.org>
CC: eranian@...gle.com, linux-kernel@...r.kernel.org, mingo@...e.hu,
paulus@...ba.org, fweisbec@...il.com, perfmon2-devel@...ts.sf.net,
eranian@...il.com
Subject: Re: [PATCH] perf_events: add sampling period randomization support
On 02.03.10 12:41:18, Peter Zijlstra wrote:
> 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);
This wont work, it will be asymmetric, e.g. for
(event->attr.sample_period & mask) == 0
the offset would be always positive. Only for
(event->attr.sample_period & mask) == (mask & ~(mask >> 1))
it is correct.
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@....com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists