From c52b9da7d6e24cf7d35a7c66d62efef1ca13f247 Mon Sep 17 00:00:00 2001 From: Ben Niu Date: Mon, 5 Jun 2023 16:58:11 +0800 Subject: Add buffer for RT throttling default config perf_event_open02 will run testing about 4s as RT thread then get HW instruction and SW task clock event counter to compare. Under kernel RT throttling default config (sched_rt_period_us=1000000, sched_rt_runtime_us=950000), the RT testing thread will sleep around 50ms for 4 times because of RT throttling. The sleeping will lead device enter idle then exit idle for 4 times. This behavior leads overhead and affect perf event counter. After update RT throttling config (sched_rt_period_us=3000000, sched_rt_runtime_us=2850000), the test case could pass because of less idle times. Bug: 285838050 Test: run vts vts_ltp_test_arm_64 (cherry picked from https://android-review.googlesource.com/q/commit:d1d611252c553db4b3b1cd9ab2f18e0e1c14396e) Merged-In: I643ed60c051f799a5c28746ac033acf563fae615 Change-Id: I643ed60c051f799a5c28746ac033acf563fae615 --- testcases/kernel/syscalls/perf_event_open/perf_event_open02.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'testcases/kernel/syscalls/perf_event_open/perf_event_open02.c') diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c index defe13c62..20dbb6133 100644 --- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c +++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c @@ -23,8 +23,8 @@ * that can count instructions. If the task clock counters in the groups * don't stop when their group gets taken off the PMU, the ratio will * instead be close to N+4. The program will declare that the test fails - * if the ratio is greater than N (actually, N + 0.0001 to allow for FP - * rounding errors). + * if the ratio is greater than N (actually, N + 0.0005 to allow for FP + * rounding errors and RT throttling overhead). */ #define _GNU_SOURCE @@ -318,7 +318,7 @@ static void verify(void) ratio = (double)vtsum / vt0; tst_res(TINFO, "ratio: %lf", ratio); - if (ratio > nhw + 0.0001) { + if (ratio > nhw + 0.0005) { tst_res(TFAIL, "test failed (ratio was greater than %d)", nhw); } else { tst_res(TPASS, "test passed"); -- cgit v1.2.3