summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid VaĊĦek <david.vasek@nic.cz>2024-12-12 14:29:04 +0100
committerDaniel Salzman <daniel.salzman@nic.cz>2024-12-12 20:21:50 +0100
commitaacd827f718f436cfc621f286244e59d7faf6d53 (patch)
treefd7a4e804f550502761a769b03a721d48795f508
parentMerge branch 'custom_atomic' (diff)
downloadknot-aacd827f718f436cfc621f286244e59d7faf6d53.tar.xz
knot-aacd827f718f436cfc621f286244e59d7faf6d53.zip
tests/atomic: lower the iteration counts with spinlock-emulated atomics
-rw-r--r--tests/contrib/test_atomic.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/contrib/test_atomic.c b/tests/contrib/test_atomic.c
index df531c385..702ab71cb 100644
--- a/tests/contrib/test_atomic.c
+++ b/tests/contrib/test_atomic.c
@@ -22,9 +22,16 @@
#include "knot/server/dthreads.h"
#define THREADS 16
-#define CYCLES1 100000
-#define CYCLES2 2000000
-#define CYCLES3 100000
+#if defined(HAVE_C11_ATOMIC) || defined(HAVE_GCC_ATOMIC)
+ #define CYCLES1 100000
+ #define CYCLES2 2000000
+ #define CYCLES3 100000
+#else
+ // Spinlock-emulated atomics. Locking is much slower, enough collisions occur,
+ #define CYCLES1 50000
+ #define CYCLES2 100000
+ #define CYCLES3 100000
+#endif
#define UPPER 0xffffffff00000000
#define LOWER 0x00000000ffffffff
#define UPPER_PTR ((void *) UPPER)