1 /* Common states for benchmarks. */
5 #include <urcu/uatomic.h>
7 extern volatile int _test_go
, _test_stop
;
9 static inline void complete_sleep(unsigned int seconds
)
11 while (seconds
!= 0) {
12 seconds
= sleep(seconds
);
16 static inline void begin_test(void)
18 uatomic_store(&_test_go
, 1, CMM_RELEASE
);
21 static inline void end_test(void)
23 uatomic_store(&_test_stop
, 1, CMM_RELAXED
);
26 static inline void test_for(unsigned int duration
)
29 complete_sleep(duration
);
33 static inline void wait_until_go(void)
35 while (!uatomic_load(&_test_go
, CMM_ACQUIRE
))
41 * returns 0 if test should end.
43 static inline int test_duration_write(void)
45 return !uatomic_load(&_test_stop
, CMM_RELAXED
);
48 static inline int test_duration_read(void)
50 return !uatomic_load(&_test_stop
, CMM_RELAXED
);
This page took 0.02978 seconds and 4 git commands to generate.