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

Function ntb_stats_clear

dpdk/examples/ntb/ntb_fwd.c:764–791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

762}
763
764static void
765ntb_stats_clear(void)
766{
767 int nb_ids, i;
768 uint32_t *ids;
769
770 /* Clear NTB dev stats */
771 nb_ids = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
772 if (nb_ids <= 0) {
773 printf("Error: Cannot get count of xstats\n");
774 return;
775 }
776 ids = malloc(sizeof(uint32_t) * nb_ids);
777 if (ids == NULL) {
778 printf("Cannot allocate memory for statistics IDs\n");
779 return;
780 }
781 for (i = 0; i < nb_ids; i++)
782 ids[i] = i;
783 rte_rawdev_xstats_reset(dev_id, ids, nb_ids);
784 printf("\n statistics for NTB port %d cleared\n", dev_id);
785
786 /* Clear Ethdev stats if have any */
787 if (fwd_mode == IOFWD && eth_port_id != RTE_MAX_ETHPORTS) {
788 rte_eth_stats_reset(eth_port_id);
789 printf("\n statistics for ETH port %d cleared\n", eth_port_id);
790 }
791}
792
793static inline void
794ntb_calculate_throughput(uint16_t port) {

Callers 1

Calls 5

mallocFunction · 0.85
rte_rawdev_xstats_resetFunction · 0.85
rte_eth_stats_resetFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected