Print out statistics on packets dropped. */
| 178 | |
| 179 | /* Print out statistics on packets dropped. */ |
| 180 | static void |
| 181 | print_stats(char *prgname) |
| 182 | { |
| 183 | struct total_statistics ts, delta_ts; |
| 184 | struct rte_dma_stats stats = {0}; |
| 185 | uint32_t i, port_id, dev_id; |
| 186 | char status_string[255]; /* to print at the top of the output */ |
| 187 | int status_strlen; |
| 188 | |
| 189 | const char clr[] = { 27, '[', '2', 'J', '\0' }; |
| 190 | const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' }; |
| 191 | |
| 192 | status_strlen = snprintf(status_string, sizeof(status_string), |
| 193 | "%s, ", prgname); |
| 194 | status_strlen += snprintf(status_string + status_strlen, |
| 195 | sizeof(status_string) - status_strlen, |
| 196 | "Worker Threads = %d, ", |
| 197 | rte_lcore_count() > 2 ? 2 : 1); |
| 198 | status_strlen += snprintf(status_string + status_strlen, |
| 199 | sizeof(status_string) - status_strlen, |
| 200 | "Copy Mode = %s,\n", copy_mode == COPY_MODE_SW_NUM ? |
| 201 | COPY_MODE_SW : COPY_MODE_DMA); |
| 202 | status_strlen += snprintf(status_string + status_strlen, |
| 203 | sizeof(status_string) - status_strlen, |
| 204 | "Updating MAC = %s, ", mac_updating ? |
| 205 | "enabled" : "disabled"); |
| 206 | status_strlen += snprintf(status_string + status_strlen, |
| 207 | sizeof(status_string) - status_strlen, |
| 208 | "Rx Queues = %d, ", nb_queues); |
| 209 | status_strlen += snprintf(status_string + status_strlen, |
| 210 | sizeof(status_string) - status_strlen, |
| 211 | "Ring Size = %d\n", ring_size); |
| 212 | status_strlen += snprintf(status_string + status_strlen, |
| 213 | sizeof(status_string) - status_strlen, |
| 214 | "Force Min Copy Size = %u Packet Data Room Size = %u", |
| 215 | force_min_copy_size, |
| 216 | rte_pktmbuf_data_room_size(dma_pktmbuf_pool) - |
| 217 | RTE_PKTMBUF_HEADROOM); |
| 218 | |
| 219 | memset(&ts, 0, sizeof(struct total_statistics)); |
| 220 | |
| 221 | while (!force_quit) { |
| 222 | /* Sleep for "stats_interval" seconds each round - init sleep allows reading |
| 223 | * messages from app startup. |
| 224 | */ |
| 225 | sleep(stats_interval); |
| 226 | |
| 227 | /* Clear screen and move to top left */ |
| 228 | printf("%s%s", clr, topLeft); |
| 229 | |
| 230 | memset(&delta_ts, 0, sizeof(struct total_statistics)); |
| 231 | |
| 232 | printf("%s\n", status_string); |
| 233 | |
| 234 | for (i = 0; i < cfg.nb_ports; i++) { |
| 235 | port_id = cfg.ports[i].rxtx_port; |
| 236 | print_port_stats(port_id); |
| 237 |
no test coverage detected