| 59 | #define MAX_LOOP 10000 |
| 60 | |
| 61 | static int |
| 62 | load_loop_fn(void *arg) |
| 63 | { |
| 64 | uint64_t time_diff = 0, begin; |
| 65 | uint64_t hz = rte_get_timer_hz(); |
| 66 | uint64_t lcount = 0; |
| 67 | const int use_lock = *(int *)arg; |
| 68 | const unsigned int lcore = rte_lcore_id(); |
| 69 | |
| 70 | /* wait synchro for workers */ |
| 71 | if (lcore != rte_get_main_lcore()) |
| 72 | rte_wait_until_equal_32(&synchro, 1, __ATOMIC_RELAXED); |
| 73 | |
| 74 | begin = rte_rdtsc_precise(); |
| 75 | while (lcount < MAX_LOOP) { |
| 76 | if (use_lock) |
| 77 | rte_pflock_write_lock(&lk); |
| 78 | lcount++; |
| 79 | if (use_lock) |
| 80 | rte_pflock_write_unlock(&lk); |
| 81 | |
| 82 | if (use_lock) { |
| 83 | rte_pflock_read_lock(&lk); |
| 84 | rte_pflock_read_unlock(&lk); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | time_diff = rte_rdtsc_precise() - begin; |
| 89 | time_count[lcore] = time_diff * 1000000 / hz; |
| 90 | return 0; |
| 91 | } |
| 92 | |
| 93 | static int |
| 94 | test_pflock_perf(void) |
no test coverage detected