[LTP] [PATCH v2 2/3] perf_event_open02: make do_work() run for specified time

Cyril Hrubis chrubis@suse.cz
Fri Nov 22 14:33:43 CET 2019


Hi!
> do_work() runtime varies a lot, because it's based on a fixed
> number of iterations. Use a timer and measure how many iterations
> are needed to run for specified time. We don't need fine accuracy,
> just some coarse runtime across all systems. verify() function is
> using larger value to get more precision for "ratio" calculation.
> 
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>  .../syscalls/perf_event_open/perf_event_open02.c   | 52 +++++++++++++++++++---
>  1 file changed, 45 insertions(+), 7 deletions(-)
> 
> Notes for v2
> --------------
> 
> Problem with v1 is that it hangs on -rt kernel. With FIFO scheduling
> signal handler never runs and there's nothing to stop do_work().
> Adding sched_yield() to periodically call in do_work() is problem too,
> because test spends more time in kernel and it breaks the expectation
> for 'ratio'.
> 
> So in v2, use timer only to estimate number of (100 thousands) loops
> needed to run for specified time. Actual test will use the estimated
> number (or multiple of it).
> 
> Tested with: 5.3.0-0.rc6.git0.1.fc31.x86_64
> 	     4.18.0-143.el8.x86_64
> 	     4.18.0-147.rt24.93.el8.x86_64

Looks good, acked.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list