X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Fproc_info%2Fmain.c;h=f2063fa3c91b455c9977543c655ecada7433bd39;hb=863bfb47449363b5ac8c9574c7247a06a2aaf1c1;hp=341176db70246f6fb2da48c95e8026fe455191dd;hpb=50810f095aa70986a9d2cc8a53b7b8db3f6ffb17;p=dpdk.git diff --git a/app/proc_info/main.c b/app/proc_info/main.c index 341176db70..f2063fa3c9 100644 --- a/app/proc_info/main.c +++ b/app/proc_info/main.c @@ -1,7 +1,7 @@ /* * BSD LICENSE * - * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -243,11 +243,13 @@ nic_stats_clear(uint8_t port_id) static void nic_xstats_display(uint8_t port_id) { - struct rte_eth_xstats *xstats; + struct rte_eth_xstat_name *xstats_names; + struct rte_eth_xstat *xstats; int len, ret, i; + int idx_name; static const char *nic_stats_border = "########################"; - len = rte_eth_xstats_get(port_id, NULL, 0); + len = rte_eth_xstats_get_names(port_id, NULL, 0); if (len < 0) { printf("Cannot get xstats count\n"); return; @@ -258,6 +260,18 @@ nic_xstats_display(uint8_t port_id) return; } + xstats_names = malloc(sizeof(struct rte_eth_xstat_name) * len); + if (xstats_names == NULL) { + printf("Cannot allocate memory for xstat names\n"); + free(xstats); + return; + } + if (len != rte_eth_xstats_get_names( + port_id, xstats_names, len)) { + printf("Cannot get xstat names\n"); + return; + } + printf("###### NIC extended statistics for port %-2d #########\n", port_id); printf("%s############################\n", @@ -270,11 +284,18 @@ nic_xstats_display(uint8_t port_id) } for (i = 0; i < len; i++) - printf("%s: %"PRIu64"\n", xstats[i].name, xstats[i].value); + for (idx_name = 0; idx_name < len; idx_name++) + if (xstats_names[idx_name].id == xstats[i].id) { + printf("%s: %"PRIu64"\n", + xstats_names[idx_name].name, + xstats[i].value); + break; + } printf("%s############################\n", nic_stats_border); free(xstats); + free(xstats_names); } static void @@ -327,10 +348,6 @@ main(int argc, char **argv) if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); - - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* If no port mask was specified*/ if (enabled_port_mask == 0) enabled_port_mask = 0xffff;