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

Function test_get_stats

dpdk/app/test/test_pmd_ring.c:131–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129
130
131static int
132test_get_stats(int port)
133{
134 struct rte_eth_stats stats;
135 struct rte_mbuf buf, *pbuf = &buf;
136
137 printf("Testing ring PMD stats_get port %d\n", port);
138
139 /* check stats of RXTX port, should all be zero */
140
141 rte_eth_stats_get(port, &stats);
142 if (stats.ipackets != 0 || stats.opackets != 0 ||
143 stats.ibytes != 0 || stats.obytes != 0 ||
144 stats.ierrors != 0 || stats.oerrors != 0) {
145 printf("Error: port %d stats are not zero\n", port);
146 return -1;
147 }
148
149 /* send and receive 1 packet and check for stats update */
150 if (rte_eth_tx_burst(port, 0, &pbuf, 1) != 1) {
151 printf("Error sending packet to port %d\n", port);
152 return -1;
153 }
154
155 if (rte_eth_rx_burst(port, 0, &pbuf, 1) != 1) {
156 printf("Error receiving packet from port %d\n", port);
157 return -1;
158 }
159
160 rte_eth_stats_get(port, &stats);
161 if (stats.ipackets != 1 || stats.opackets != 1 ||
162 stats.ibytes != 0 || stats.obytes != 0 ||
163 stats.ierrors != 0 || stats.oerrors != 0) {
164 printf("Error: port %d stats are not as expected\n", port);
165 return -1;
166 }
167 return 0;
168}
169
170static int
171test_stats_reset(int port)

Callers 2

test_get_stats_for_portFunction · 0.85

Calls 4

rte_eth_stats_getFunction · 0.85
rte_eth_tx_burstFunction · 0.85
rte_eth_rx_burstFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected