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

Function perf_test

dpdk/app/test/test_distributor_perf.c:145–186  ·  view source on GitHub ↗

* This basic performance test just repeatedly sends in 32 packets at a time * to the distributor and verifies at the end that we got them all in the worker * threads and finally how long per packet the processing took. */

Source from the content-addressed store, hash-verified

143 * threads and finally how long per packet the processing took.
144 */
145static inline int
146perf_test(struct rte_distributor *d, struct rte_mempool *p)
147{
148 unsigned int i;
149 uint64_t start, end;
150 struct rte_mbuf *bufs[BURST];
151
152 clear_packet_count();
153 if (rte_mempool_get_bulk(p, (void *)bufs, BURST) != 0) {
154 printf("Error getting mbufs from pool\n");
155 return -1;
156 }
157 /* ensure we have different hash value for each pkt */
158 for (i = 0; i < BURST; i++)
159 bufs[i]->hash.usr = i;
160
161 start = rte_rdtsc();
162 for (i = 0; i < (1<<ITER_POWER); i++)
163 rte_distributor_process(d, bufs, BURST);
164 end = rte_rdtsc();
165
166 do {
167 usleep(100);
168 rte_distributor_process(d, NULL, 0);
169 } while (total_packet_count() < (BURST << ITER_POWER));
170
171 rte_distributor_clear_returns(d);
172
173 printf("Time per burst: %"PRIu64"\n", (end - start) >> ITER_POWER);
174 printf("Time per packet: %"PRIu64"\n\n",
175 ((end - start) >> ITER_POWER)/BURST);
176 rte_mempool_put_bulk(p, (void *)bufs, BURST);
177
178 for (i = 0; i < rte_lcore_count() - 1; i++)
179 printf("Worker %u handled %u packets\n", i,
180 worker_stats[i].handled_packets);
181 printf("Total packets: %u (%x)\n", total_packet_count(),
182 total_packet_count());
183 printf("=== Perf test done ===\n\n");
184
185 return 0;
186}
187
188/* Useful function which ensures that all worker functions terminate */
189static void

Callers 1

test_distributor_perfFunction · 0.70

Calls 9

rte_mempool_get_bulkFunction · 0.85
rte_distributor_processFunction · 0.85
rte_mempool_put_bulkFunction · 0.85
rte_lcore_countFunction · 0.85
clear_packet_countFunction · 0.70
total_packet_countFunction · 0.70
printfFunction · 0.50
rte_rdtscFunction · 0.50

Tested by

no test coverage detected