From 47fba17d8e729fb07d05e8cedf744da105f230c7 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Mon, 7 Jun 2021 11:51:13 +0200 Subject: [PATCH] sadf: PCP: Don't check for newly registered network interfaces It is useless to check if current network interface has just been registered or not before displaying its PCP statistics. This is because PCP displays the raw counter values, not their variation over the interval. Moreover the whole list of network interfaces present in file has been created with each one having already its instance. Signed-off-by: Sebastien GODARD --- pcp_stats.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/pcp_stats.c b/pcp_stats.c index 3191b4e..9374d0f 100644 --- a/pcp_stats.c +++ b/pcp_stats.c @@ -565,7 +565,7 @@ __print_funct_t pcp_print_disk_stats(struct activity *a, int curr) __print_funct_t pcp_print_net_dev_stats(struct activity *a, int curr) { #ifdef HAVE_PCP - int i, j; + int i; struct stats_net_dev *sndc; char buf[64]; @@ -580,11 +580,14 @@ __print_funct_t pcp_print_net_dev_stats(struct activity *a, int curr) continue; } - j = check_net_dev_reg(a, curr, !curr, i); - if (j < 0) { - /* This is a newly registered interface */ - /* TODO: add a new instance? */ - } + /* + * No need to look for the previous sample values: PCP displays the raw + * counter value, not its variation over the interval. + * The whole list of network interfaces present in file has been created + * (this is goal of the FO_ITEM_LIST option set for pcp_fmt report format - + * see format.c). So no need to wonder if an instance needs to be created + * for current interface. + */ snprintf(buf, sizeof(buf), "%llu", sndc->rx_packets); pmiPutValue("network.interface.in.packets", sndc->interface, buf); @@ -622,7 +625,7 @@ __print_funct_t pcp_print_net_dev_stats(struct activity *a, int curr) __print_funct_t pcp_print_net_edev_stats(struct activity *a, int curr) { #ifdef HAVE_PCP - int i, j; + int i; struct stats_net_edev *snedc; char buf[64]; @@ -637,12 +640,6 @@ __print_funct_t pcp_print_net_edev_stats(struct activity *a, int curr) continue; } - j = check_net_edev_reg(a, curr, !curr, i); - if (j < 0) { - /* This is a newly registered interface */ - /* TODO: add a new instance? */ - } - snprintf(buf, sizeof(buf), "%llu", snedc->rx_errors); pmiPutValue("network.interface.in.errors", snedc->interface, buf); -- 2.40.0