MCPcopy Create free account
hub / github.com/F-Stack/f-stack / load_loop_fn

Function load_loop_fn

dpdk/app/test/test_ticketlock.c:104–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102#define MAX_LOOP 10000
103
104static int
105load_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
130static int
131test_ticketlock_perf(void)

Callers 1

test_ticketlock_perfFunction · 0.70

Calls 6

rte_lcore_idFunction · 0.85
rte_get_main_lcoreFunction · 0.85
rte_ticketlock_lockFunction · 0.85
rte_ticketlock_unlockFunction · 0.85
rte_wait_until_equal_32Function · 0.50
rte_rdtsc_preciseFunction · 0.50

Tested by

no test coverage detected