lkml.org 
[lkml]   [2022]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf stat: Do not delay the workload with --delay
On Mon, Dec 12, 2022 at 03:08:20PM -0800, Namhyung Kim wrote:
> The -D/--delay option is to delay the measure after the program starts.
> But the current code goes to sleep before starting the program so the
> program is delayed too. This is not the intention, let's fix it.
>
> Before:
>
> $ time sudo ./perf stat -a -e cycles -D 3000 sleep 4
> Events disabled
> Events enabled
>
> Performance counter stats for 'system wide':
>
> 4,326,949,337 cycles
>
> 4.007494118 seconds time elapsed
>
> real 0m7.474s
> user 0m0.356s
> sys 0m0.120s
>
> It ran the workload for 4 seconds and gave the 3 second delay. So it
> should skip the first 3 second and measure the last 1 second only. But
> as you can see, it delays 3 seconds and ran the workload after that for
> 4 seconds. So the total time (real) was 7 seconds.
>
> After:
>
> $ time sudo ./perf stat -a -e cycles -D 3000 sleep 4
> Events disabled
> Events enabled
>
> Performance counter stats for 'system wide':
>
> 1,063,551,013 cycles
>
> 1.002769510 seconds time elapsed
>
> real 0m4.484s
> user 0m0.385s
> sys 0m0.086s
>
> The bug was introduced when it changed enablement of system-wide events
> with a command line workload. But it should've considered the initial
> delay case. The code was reworked since then (in bb8bc52e7578) so I'm
> afraid it won't be applied cleanly.
>
> Fixes: d0a0a511493d ("perf stat: Fix forked applications enablement of counters")
> Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
> Cc: Thomas Richter <tmricht@linux.ibm.com>
> Reported-by: Kevin Nomura <nomurak@google.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Reviewed-by: Leo Yan <leo.yan@linaro.org>

\
 
 \ /
  Last update: 2022-12-15 02:45    [W:0.080 / U:0.868 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site