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

Function load_loop_fn

dpdk/app/test/test_pflock.c:61–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59#define MAX_LOOP 10000
60
61static int
62load_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
93static int
94test_pflock_perf(void)

Callers 1

test_pflock_perfFunction · 0.70

Calls 8

rte_lcore_idFunction · 0.85
rte_get_main_lcoreFunction · 0.85
rte_pflock_write_lockFunction · 0.85
rte_pflock_write_unlockFunction · 0.85
rte_pflock_read_lockFunction · 0.85
rte_pflock_read_unlockFunction · 0.85
rte_wait_until_equal_32Function · 0.50
rte_rdtsc_preciseFunction · 0.50

Tested by

no test coverage detected