Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
test_urcu_mb_gc test_qsbr_gc test_qsbr_lgc test_urcu_signal_lgc \
test_urcu_mb_lgc test_qsbr_dynamic_link test_urcu_defer \
test_uatomic test_urcu_assign test_urcu_assign_dynamic_link \
- test_urcu_bp test_urcu_bp_dynamic_link
+ test_urcu_bp test_urcu_bp_dynamic_link test_cycles_per_loop
noinst_HEADERS = rcutorture.h
if COMPAT_ARCH
test_uatomic_SOURCES = test_uatomic.c $(COMPAT)
+test_cycles_per_loop_SOURCES = test_cycles_per_loop.c
+
test_urcu_assign_SOURCES = test_urcu_assign.c $(URCU)
test_urcu_assign_dynamic_link_SOURCES = test_urcu_assign.c $(URCU)
--- /dev/null
+#include <urcu/arch.h>
+#include <stdio.h>
+
+#define NR_LOOPS 1000000UL
+
+static inline void loop_sleep(unsigned long l)
+{
+ while(l-- != 0)
+ cpu_relax();
+}
+
+int main()
+{
+ cycles_t time1, time2;
+
+ time1 = get_cycles();
+ loop_sleep(NR_LOOPS);
+ time2 = get_cycles();
+ printf("CPU clock cycles per loop: %g\n", (time2 - time1) /
+ (double)NR_LOOPS);
+}