Re: [Patch v3 0/2] perf record: ratio-to-prev event term for auto counter reload
From: Arnaldo Carvalho de Melo
Date: Fri Oct 03 2025 - 15:28:07 EST
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
> v2: (changes below suggested by Ian Rogers):