Re: [PATCH v2 1/5] perf: Allow periodic events to alternate between two sample periods
From: Leo Yan
Date: Mon Mar 10 2025 - 06:57:21 EST
On Fri, Mar 07, 2025 at 08:28:13PM +0000, Mark Barnett wrote:
> On 1/21/25 13:01, Leo Yan wrote:
> > > local64_set(&hwc->period_left, hwc->sample_period);
> > > + if (attr->alt_sample_period) {
> > > + hwc->sample_period = attr->alt_sample_period;
> > > + hwc->using_alt_sample_period = true;
> > > + }
> >
> > My understanding it sets a short sample window for the first period.
> > Would it initialize the `hwc->period_left` with the updated sample
> > period?
> >
>
> It sets the long period first: hwc->period_left is used to program the PMU
> when setting up the event, and hwc->sample_period is queued up as the next
> period to switch to.
Makes sense to me. Thanks for explanation.
Leo