aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-08-02 23:07:33 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-08-02 23:07:33 +0000
commite4d8ddafc8ab03f1cb0a62c9b35271860942ea8f (patch)
treeebbac187d1b4096a25072c9052f17515b5fd4e46
parent796c31279f04f38de848f9b1e0adafa34d6d48e2 (diff)
parent41c8d3e8ace06400c2f65f138d34e22ca7720875 (diff)
downloadltp-android14-d1-s1-release.tar.gz
Change-Id: Ibb1c928b59780b2c2573ddd83c2a0d448d6fc9fe
-rw-r--r--lib/tst_timer_test.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/tst_timer_test.c b/lib/tst_timer_test.c
index ef9b24d11..eaafc6f0f 100644
--- a/lib/tst_timer_test.c
+++ b/lib/tst_timer_test.c
@@ -15,6 +15,11 @@
#include "tst_timer_test.h"
#define MAX_SAMPLES 500
+#if defined (__arm__) || defined(__aarch64__)
+#define BASE_THRESHOLD 500
+#else
+#define BASE_THRESHOLD 400
+#endif
static const char *scall;
static void (*setup)(void);
@@ -166,8 +171,10 @@ static int cmp(const void *a, const void *b)
/*
* The threshold per one syscall is computed as a sum of:
*
- * 400 us - accomodates for context switches, process
- * migrations between CPUs on SMP, etc.
+ * 400 or 500 us - accomodates for context switches, process
+ * migrations between CPUs on SMP, etc. Increase to
+ * 500 on arm/arm64 to allow for increased little CPU
+ * scheduling
* 2*monotonic_resolution - accomodates for granurality of the CLOCK_MONOTONIC
* slack_per_scall - max of 0.1% of the sleep capped on 100ms or
* current->timer_slack_ns, which is slack allowed
@@ -188,7 +195,7 @@ static long long compute_threshold(long long requested_us,
slack_per_scall = MAX(slack_per_scall, timerslack);
- return (400 + 2 * monotonic_resolution + slack_per_scall) * nsamples
+ return (BASE_THRESHOLD + 2 * monotonic_resolution + slack_per_scall) * nsamples
+ 3000/nsamples;
}