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

Function test_fib_perf

dpdk/app/test/test_fib_perf.c:319–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319static int
320test_fib_perf(void)
321{
322 struct rte_fib *fib = NULL;
323 struct rte_fib_conf config;
324
325 config.max_routes = 2000000;
326 config.rib_ext_sz = 0;
327 config.type = RTE_FIB_DIR24_8;
328 config.default_nh = 0;
329 config.dir24_8.nh_sz = RTE_FIB_DIR24_8_4B;
330 config.dir24_8.num_tbl8 = 65535;
331 uint64_t begin, total_time;
332 unsigned int i, j;
333 uint32_t next_hop_add = 0xAA;
334 int status = 0;
335 int64_t count = 0;
336
337 rte_srand(rte_rdtsc());
338
339 generate_large_route_rule_table();
340
341 printf("No. routes = %u\n", (unsigned int) NUM_ROUTE_ENTRIES);
342
343 print_route_distribution(large_route_table,
344 (uint32_t) NUM_ROUTE_ENTRIES);
345
346 fib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);
347 TEST_FIB_ASSERT(fib != NULL);
348
349 /* Measure add. */
350 begin = rte_rdtsc();
351
352 for (i = 0; i < NUM_ROUTE_ENTRIES; i++) {
353 if (rte_fib_add(fib, large_route_table[i].ip,
354 large_route_table[i].depth, next_hop_add) == 0)
355 status++;
356 }
357 /* End Timer. */
358 total_time = rte_rdtsc() - begin;
359
360 printf("Unique added entries = %d\n", status);
361
362 printf("Average FIB Add: %g cycles\n",
363 (double)total_time / NUM_ROUTE_ENTRIES);
364
365 /* Measure bulk Lookup */
366 total_time = 0;
367 count = 0;
368 for (i = 0; i < ITERATIONS; i++) {
369 static uint32_t ip_batch[BATCH_SIZE];
370 uint64_t next_hops[BULK_SIZE];
371
372 /* Create array of random IP addresses */
373 for (j = 0; j < BATCH_SIZE; j++)
374 ip_batch[j] = rte_rand();
375
376 /* Lookup per batch */

Callers

nothing calls this directly

Calls 11

rte_srandFunction · 0.85
rte_fib_createFunction · 0.85
rte_fib_addFunction · 0.85
rte_randFunction · 0.85
rte_fib_lookup_bulkFunction · 0.85
rte_fib_deleteFunction · 0.85
rte_fib_freeFunction · 0.85
print_route_distributionFunction · 0.70
rte_rdtscFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected