From 9e269cfc83fa2568b1424192a69064ccef2a8903 Mon Sep 17 00:00:00 2001 From: Yury Khmel Date: Thu, 18 May 2023 14:31:05 -0700 Subject: arc: Fix CTS tests for grunt Waiting loop has 1us delay waiting for requested changes are propagated. This is too aggressive and Grunt and other low-end devices may have no chance to react in specific timeout. Bug: 265675811 Test: cts-tradefed run commandAndExit cts -m CtsSimpleperfTestCases Most tests are now passing: Total Tests : 540 PASSED : 528 FAILED : 12 Change-Id: Ida041674c2fea425e6d267ee6a973208da00ed71 --- simpleperf/environment.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/simpleperf/environment.cpp b/simpleperf/environment.cpp index 5b2fcaa8..4cc47914 100644 --- a/simpleperf/environment.cpp +++ b/simpleperf/environment.cpp @@ -388,9 +388,10 @@ bool SetPerfEventLimits(uint64_t sample_freq, size_t cpu_percent, uint64_t mlock } // Wait for init process to change perf event limits based on properties. const size_t max_wait_us = 3 * 1000000; + const size_t interval_us = 10000; int finish_mask = 0; - for (size_t i = 0; i < max_wait_us && finish_mask != 7; ++i) { - usleep(1); // Wait 1us to avoid busy loop. + for (size_t i = 0; i < max_wait_us && finish_mask != 7; i += interval_us) { + usleep(interval_us); // Wait 10ms to avoid busy loop. if ((finish_mask & 1) == 0) { uint64_t freq; if (!GetMaxSampleFrequency(&freq) || freq == sample_freq) { -- cgit v1.2.3