X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Fproc_info%2Fmain.c;h=8246fb2aec226fddbfe32077b9a054fc8f53120f;hb=afd6aa6fd9165c164f4d26e162f3829d512e9ef9;hp=5f8309244badff54e8495aa7b83d9735f317aa82;hpb=b4e0f64ff271ccc78f6275b6bd49194e86fd4f4b;p=dpdk.git diff --git a/app/proc_info/main.c b/app/proc_info/main.c index 5f8309244b..8246fb2aec 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,12 @@ 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; 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 +259,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 +283,14 @@ nic_xstats_display(uint8_t port_id) } for (i = 0; i < len; i++) - printf("%s: %"PRIu64"\n", xstats[i].name, xstats[i].value); + printf("%s: %"PRIu64"\n", + xstats_names[i].name, + xstats[i].value); printf("%s############################\n", nic_stats_border); free(xstats); + free(xstats_names); } static void @@ -313,6 +329,9 @@ main(int argc, char **argv) argc -= ret; argv += (ret - 3); + if (!rte_eal_primary_proc_alive(NULL)) + rte_exit(EXIT_FAILURE, "No primary DPDK process is running.\n"); + /* parse app arguments */ ret = proc_info_parse_args(argc, argv); if (ret < 0)