/trunk/kernel/test/atomic/atomic1.c/test.c |
---|
31,8 → 31,15 |
#include <atomic.h> |
#include <debug.h> |
void test(void) |
#ifdef CONFIG_BENCH |
#include <arch/cycle.h> |
#endif |
void test_atomic1(void) |
{ |
#ifdef CONFIG_BENCH |
uint64_t t0 = get_cycle(); |
#endif |
atomic_t a; |
atomic_set(&a, 10); |
51,6 → 58,10 |
ASSERT(atomic_postdec(&a) == 11); |
ASSERT(atomic_get(&a) == 10); |
printf("Test passed.\n"); |
printf("Test passed.\n"); |
#ifdef CONFIG_BENCH |
uint64_t dt = get_cycle() - t0; |
printf("Time: %.*d cycles\n", sizeof(dt) * 2, dt); |
#endif |
return; |
} |