| 102 | #define MAX_LOOP 10000 |
| 103 | |
| 104 | static int |
| 105 | load_loop_fn(void *func_param) |
| 106 | { |
| 107 | uint64_t time_diff = 0, begin; |
| 108 | uint64_t hz = rte_get_timer_hz(); |
| 109 | const int use_lock = *(int *)func_param; |
| 110 | const unsigned int lcore = rte_lcore_id(); |
| 111 | |
| 112 | /* wait synchro for workers */ |
| 113 | if (lcore != rte_get_main_lcore()) |
| 114 | rte_wait_until_equal_32(&synchro, 1, __ATOMIC_RELAXED); |
| 115 | |
| 116 | begin = rte_rdtsc_precise(); |
| 117 | while (lcore_count[lcore] < MAX_LOOP) { |
| 118 | if (use_lock) |
| 119 | rte_ticketlock_lock(&lk); |
| 120 | lcore_count[lcore]++; |
| 121 | lcount++; |
| 122 | if (use_lock) |
| 123 | rte_ticketlock_unlock(&lk); |
| 124 | } |
| 125 | time_diff = rte_rdtsc_precise() - begin; |
| 126 | time_cost[lcore] = time_diff * 1000000 / hz; |
| 127 | return 0; |
| 128 | } |
| 129 | |
| 130 | static int |
| 131 | test_ticketlock_perf(void) |
no test coverage detected