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

Function nic_xstats_by_ids_display

dpdk/app/proc-info/main.c:759–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

757}
758
759static void
760nic_xstats_by_ids_display(uint16_t port_id, uint64_t *ids, int len)
761{
762 struct rte_eth_xstat_name *xstats_names;
763 uint64_t *values;
764 int ret, i;
765 static const char *nic_stats_border = "########################";
766
767 values = malloc(sizeof(*values) * len);
768 if (values == NULL) {
769 printf("Cannot allocate memory for xstats\n");
770 return;
771 }
772
773 xstats_names = malloc(sizeof(struct rte_eth_xstat_name) * len);
774 if (xstats_names == NULL) {
775 printf("Cannot allocate memory for xstat names\n");
776 free(values);
777 return;
778 }
779
780 if (len != rte_eth_xstats_get_names_by_id(
781 port_id, xstats_names, len, ids)) {
782 printf("Cannot get xstat names\n");
783 goto err;
784 }
785
786 printf("###### NIC extended statistics for port %-2d #########\n",
787 port_id);
788 printf("%s############################\n", nic_stats_border);
789 ret = rte_eth_xstats_get_by_id(port_id, ids, values, len);
790 if (ret < 0 || ret > len) {
791 printf("Cannot get xstats\n");
792 goto err;
793 }
794
795 for (i = 0; i < len; i++)
796 printf("%s: %"PRIu64"\n",
797 xstats_names[i].name,
798 values[i]);
799
800 printf("%s############################\n", nic_stats_border);
801err:
802 free(values);
803 free(xstats_names);
804}
805
806static void
807nic_xstats_display(uint16_t port_id)

Callers 1

mainFunction · 0.85

Calls 5

mallocFunction · 0.85
rte_eth_xstats_get_by_idFunction · 0.85
printfFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected