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

Function test_lpm6_perf

dpdk/app/test/test_lpm6_perf.c:54–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54static int
55test_lpm6_perf(void)
56{
57 struct rte_lpm6 *lpm = NULL;
58 struct rte_lpm6_config config;
59 uint64_t begin, total_time;
60 unsigned i, j;
61 uint32_t next_hop_add = 0xAA, next_hop_return = 0;
62 int status = 0;
63 int64_t count = 0;
64
65 config.max_rules = 1000000;
66 config.number_tbl8s = NUMBER_TBL8S;
67 config.flags = 0;
68
69 rte_srand(rte_rdtsc());
70
71 printf("No. routes = %u\n", (unsigned) NUM_ROUTE_ENTRIES);
72
73 print_route_distribution(large_route_table, (uint32_t) NUM_ROUTE_ENTRIES);
74
75 /* Only generate IPv6 address of each item in large IPS table,
76 * here next_hop is not needed.
77 */
78 generate_large_ips_table(0);
79
80 lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
81 TEST_LPM_ASSERT(lpm != NULL);
82
83 /* Measure add. */
84 begin = rte_rdtsc();
85
86 for (i = 0; i < NUM_ROUTE_ENTRIES; i++) {
87 if (rte_lpm6_add(lpm, large_route_table[i].ip,
88 large_route_table[i].depth, next_hop_add) == 0)
89 status++;
90 }
91 /* End Timer. */
92 total_time = rte_rdtsc() - begin;
93
94 printf("Unique added entries = %d\n", status);
95 printf("Average LPM Add: %g cycles\n",
96 (double)total_time / NUM_ROUTE_ENTRIES);
97
98 /* Measure single Lookup */
99 total_time = 0;
100 count = 0;
101
102 for (i = 0; i < ITERATIONS; i ++) {
103 begin = rte_rdtsc();
104
105 for (j = 0; j < NUM_IPS_ENTRIES; j ++) {
106 if (rte_lpm6_lookup(lpm, large_ips_table[j].ip,
107 &next_hop_return) != 0)
108 count++;
109 }
110
111 total_time += rte_rdtsc() - begin;

Callers

nothing calls this directly

Calls 13

rte_srandFunction · 0.85
generate_large_ips_tableFunction · 0.85
print_route_distributionFunction · 0.70
rte_rdtscFunction · 0.50
printfFunction · 0.50
rte_lpm6_createFunction · 0.50
rte_lpm6_addFunction · 0.50
rte_lpm6_lookupFunction · 0.50
memcpyFunction · 0.50
rte_lpm6_deleteFunction · 0.50
rte_lpm6_delete_allFunction · 0.50

Tested by

no test coverage detected