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

Function statistics_loop

dpdk/app/dumpcap/main.c:482–511  ·  view source on GitHub ↗

Instead of capturing, it tracks interface statistics */

Source from the content-addressed store, hash-verified

480
481/* Instead of capturing, it tracks interface statistics */
482static void statistics_loop(void)
483{
484 struct rte_eth_stats stats;
485 char name[RTE_ETH_NAME_MAX_LEN];
486 uint16_t p;
487 int r;
488
489 printf("%-15s %10s %10s\n",
490 "Interface", "Received", "Dropped");
491
492 while (!__atomic_load_n(&quit_signal, __ATOMIC_RELAXED)) {
493 RTE_ETH_FOREACH_DEV(p) {
494 if (rte_eth_dev_get_name_by_port(p, name) < 0)
495 continue;
496
497 r = rte_eth_stats_get(p, &stats);
498 if (r < 0) {
499 fprintf(stderr,
500 "stats_get for port %u failed: %d (%s)\n",
501 p, r, strerror(-r));
502 return;
503 }
504
505 printf("%-15s %10"PRIu64" %10"PRIu64"\n",
506 name, stats.ipackets,
507 stats.imissed + stats.ierrors + stats.rx_nombuf);
508 }
509 sleep(1);
510 }
511}
512
513static void
514cleanup_pdump_resources(void)

Callers 1

mainFunction · 0.85

Calls 3

rte_eth_stats_getFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected