#include <rte_tailq.h>
#include <rte_per_lcore.h>
#include <rte_lcore.h>
-#include <rte_debug.h>
#include <rte_log.h>
#include <rte_atomic.h>
#include <rte_branch_prediction.h>
"default\n"
" --metrics: to display derived metrics of the ports, disabled by "
"default\n"
- " --xstats-name NAME: to display single xstat value by NAME\n"
+ " --xstats-name NAME: to display single xstat id by NAME\n"
" --xstats-ids IDLIST: to display xstat values by id. "
"The argument is comma-separated list of xstat ids to print out.\n"
" --stats-reset: to reset port statistics\n"
int ret, i;
static const char *nic_stats_border = "########################";
- values = malloc(sizeof(values) * len);
+ values = malloc(sizeof(*values) * len);
if (values == NULL) {
printf("Cannot allocate memory for xstats\n");
return;
return;
}
- if (len != rte_eth_xstats_get_names(
+ if (len != rte_eth_xstats_get_names_by_id(
port_id, xstats_names, len, ids)) {
printf("Cannot get xstat names\n");
goto err;
printf("###### NIC extended statistics for port %-2d #########\n",
port_id);
printf("%s############################\n", nic_stats_border);
- ret = rte_eth_xstats_get(port_id, ids, values, len);
+ ret = rte_eth_xstats_get_by_id(port_id, ids, values, len);
if (ret < 0 || ret > len) {
printf("Cannot get xstats\n");
goto err;
int len, ret, i;
static const char *nic_stats_border = "########################";
- len = rte_eth_xstats_get_names(port_id, NULL, 0, NULL);
+ len = rte_eth_xstats_get_names_by_id(port_id, NULL, 0, NULL);
if (len < 0) {
printf("Cannot get xstats count\n");
return;
}
- values = malloc(sizeof(values) * len);
+ values = malloc(sizeof(*values) * len);
if (values == NULL) {
printf("Cannot allocate memory for xstats\n");
return;
free(values);
return;
}
- if (len != rte_eth_xstats_get_names(
+ if (len != rte_eth_xstats_get_names_by_id(
port_id, xstats_names, len, NULL)) {
printf("Cannot get xstat names\n");
goto err;
port_id);
printf("%s############################\n",
nic_stats_border);
- ret = rte_eth_xstats_get(port_id, NULL, values, len);
+ ret = rte_eth_xstats_get_by_id(port_id, NULL, values, len);
if (ret < 0 || ret > len) {
printf("Cannot get xstats\n");
goto err;
sprintf(buf, "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%"
PRIu64"\n", host_id, port_id, counter_type,
xstats_names[i].name, values[i]);
- write(stdout_fd, buf, strlen(buf));
+ ret = write(stdout_fd, buf, strlen(buf));
+ if (ret < 0)
+ goto err;
} else {
printf("%s: %"PRIu64"\n", xstats_names[i].name,
values[i]);