Re: [PATCH v1 1/4] perf stat: Allow no events to open if this is a "--null" run
From: Ian Rogers
Date: Wed Dec 03 2025 - 16:49:20 EST
On Mon, Dec 1, 2025 at 8:52 PM Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
>
> * Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
> > With all 4 patches applied to v6.18 'perf stat --null'
> > works fine:
> >
> > Tested-by: Ingo Molnar <mingo@xxxxxxxxxx>
>
> BTW., there's a long-standing perf-stat --repeat bug
> where signals don't seem to get properly propagated.
>
> The following command takes 10 seconds to run, as
> expected:
>
> starship:~/tip> perf stat --null --repeat 10 sleep 1
>
> Performance counter stats for 'sleep 1' (10 runs):
>
> 1.0026669 +- 0.0000503 seconds time elapsed ( +- 0.01% )
>
> But if I try to interrupt the test:
>
> starship:~/tip> perf stat --null --repeat 10 sleep 1
> ^Csleep: Interrupt
> ^Csleep: Interrupt
>
> Performance counter stats for 'sleep 1' (10 runs):
>
> 0.9250 +- 0.0543 seconds time elapsed ( +- 5.87% )
>
>
> The Ctrl-C only propagates to the <command>, interrupts
> it (as can be seen from the shortened total runtime
> that is less than 10 seconds), and otherwise results in
> both an incorrect measurement and a misleading output
> of the partial results.
>
> Furthermore, the test runs to full completion - which
> can be annoying if you happen to use high --repeat
> counts like I sometimes do. I have to Ctrl-Z and
> killall -9 perf to kill such instances.
I've added a patch that hopefully fixes this in the v2 patch series:
https://lore.kernel.org/lkml/20251203214706.112174-8-irogers@xxxxxxxxxx/
Thanks,
Ian
> Thanks,
>
> Ingo