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

Function test_fib6_perf

dpdk/app/test/test_fib6_perf.c:66–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66static int
67test_fib6_perf(void)
68{
69 struct rte_fib6 *fib = NULL;
70 struct rte_fib6_conf conf;
71 uint64_t begin, total_time;
72 unsigned int i, j;
73 uint64_t next_hop_add;
74 int status = 0;
75 int64_t count = 0;
76 uint8_t ip_batch[NUM_IPS_ENTRIES][16];
77 uint64_t next_hops[NUM_IPS_ENTRIES];
78
79 conf.type = RTE_FIB6_TRIE;
80 conf.default_nh = 0;
81 conf.max_routes = 1000000;
82 conf.rib_ext_sz = 0;
83 conf.trie.nh_sz = RTE_FIB6_TRIE_4B;
84 conf.trie.num_tbl8 = RTE_MIN(get_max_nh(conf.trie.nh_sz), 1000000U);
85
86 rte_srand(rte_rdtsc());
87
88 printf("No. routes = %u\n", (unsigned int) NUM_ROUTE_ENTRIES);
89
90 print_route_distribution(large_route_table,
91 (uint32_t)NUM_ROUTE_ENTRIES);
92
93 /* Only generate IPv6 address of each item in large IPS table,
94 * here next_hop is not needed.
95 */
96 generate_large_ips_table(0);
97
98 fib = rte_fib6_create(__func__, SOCKET_ID_ANY, &conf);
99 TEST_FIB_ASSERT(fib != NULL);
100
101 /* Measure add. */
102 begin = rte_rdtsc();
103
104 for (i = 0; i < NUM_ROUTE_ENTRIES; i++) {
105 next_hop_add = (i & ((1 << 14) - 1)) + 1;
106 if (rte_fib6_add(fib, large_route_table[i].ip,
107 large_route_table[i].depth, next_hop_add) == 0)
108 status++;
109 }
110 /* End Timer. */
111 total_time = rte_rdtsc() - begin;
112
113 printf("Unique added entries = %d\n", status);
114 printf("Average FIB Add: %g cycles\n",
115 (double)total_time / NUM_ROUTE_ENTRIES);
116
117 /* Measure bulk Lookup */
118 total_time = 0;
119 count = 0;
120
121 for (i = 0; i < NUM_IPS_ENTRIES; i++)
122 memcpy(ip_batch[i], large_ips_table[i].ip, 16);
123

Callers

nothing calls this directly

Calls 12

rte_srandFunction · 0.85
generate_large_ips_tableFunction · 0.85
rte_fib6_createFunction · 0.85
rte_fib6_addFunction · 0.85
rte_fib6_lookup_bulkFunction · 0.85
rte_fib6_deleteFunction · 0.85
rte_fib6_freeFunction · 0.85
get_max_nhFunction · 0.70
print_route_distributionFunction · 0.70
rte_rdtscFunction · 0.50
printfFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected