]> granicus.if.org Git - sysstat/commitdiff
sadf: PCP: Don't check for newly registered network interfaces
authorSebastien GODARD <sysstat@users.noreply.github.com>
Mon, 7 Jun 2021 09:51:13 +0000 (11:51 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Mon, 7 Jun 2021 09:51:13 +0000 (11:51 +0200)
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 <sysstat@users.noreply.github.com>
pcp_stats.c

index 3191b4e86e4100816abf2162c65e7c289a61c604..9374d0f32dbefdecec3954f258a7a30946ff632b 100644 (file)
@@ -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);