Re: [Patch v3 0/2] perf record: ratio-to-prev event term for auto counter reload

From: Falcon, Thomas

Date: Mon Oct 06 2025 - 12:24:11 EST


On Fri, 2025-10-03 at 16:27 -0300, Arnaldo Carvalho de Melo wrote:
> On Thu, Oct 02, 2025 at 06:43:04PM -0500,
> thomas.falcon@xxxxxxxxx wrote:
> > The goal is to limit event sampling to cases when the branch miss
> > rate
> > exceeds 20%. If the branch instructions sample period is exceeded
> > first, both events are reloaded.  If branch misses exceed their
> > threshold first, only the second counter is reloaded, and a sample
> > is
> > taken.
>  
> > To simplify this, provide a new “ratio-to-prev” event term
> > that works alongside the period event option or -c option.
> > This would allow users to specify the desired relative rate
> > between events as a ratio, making configuration more intuitive.
>  
> > With this enhancement, the equivalent command would be:
> >
> > perf record -e "{cpu_atom/branch-misses/ppu,\
> > cpu_atom/branch-instructions,period=1000000,ratio_to_prev=5/u}" \
> > -- ./mispredict
> > or
> > perf record -e "{cpu_atom/branch-misses/ppu,\
> > cpu_atom/branch-instructions,ratio-to-prev=5/u}" -c 1000000 \
> > -- ./mispredict
> > [1]
> > https://lore.kernel.org/lkml/20250327195217.2683619-1-kan.liang@xxxxxxxxxxxxxxx/
> > v3: rebase to current perf-tools-next
>
> Thanks, applied to perf-tools-next,
>
> - Arnaldo
>  

Thank you and thanks to Ian and everyone else that took their time to
review.

Thanks,
Tom

> > v2: (changes below suggested by Ian Rogers):
>