]> granicus.if.org Git - sysstat/commitdiff
sar: Display all items for USB and filesystems activities
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 19 Jan 2018 15:10:14 +0000 (16:10 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 19 Jan 2018 15:10:14 +0000 (16:10 +0100)
The summary displayed by sar for USB and filesystems activities didn't
include all the items. In pacticular, filesystems or USB devices that
had been unmounted were not displayed in the summary ending the report.
This patch fixes the problem.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
pr_stats.c

index 59aac5a81393fde7e8163b630e16e186ab21a1fe..e1d06cc00fec1a87585d8ee6f3cc1ebee678e8ee 100644 (file)
@@ -2649,6 +2649,7 @@ void stub_print_pwr_usb_stats(struct activity *a, int curr, int dispavg)
                                         * Save USB device in summary list.
                                         */
                                        *sum = *suc;
+                                       a->nr[2] = j + 1;
                                        break;
                                }
                        }
@@ -2660,6 +2661,7 @@ void stub_print_pwr_usb_stats(struct activity *a, int curr, int dispavg)
                                reallocate_all_buffers(a);
                                sum = (struct stats_pwr_usb *) ((char *) a->buf[2] + j * a->msize);
                                *sum = *suc;
+                               a->nr[2] = j + 1;
                        }
                }
        }
@@ -2761,6 +2763,9 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int curr, int di
                                         * or free slot (end of list).
                                         */
                                        *sfm = *sfc;
+                                       if (j >= a->nr[2]) {
+                                               a->nr[2] = j + 1;
+                                       }
                                        break;
                                }
                        }
@@ -2772,6 +2777,7 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int curr, int di
                                reallocate_all_buffers(a);
                                sfm = (struct stats_filesystem *) ((char *) a->buf[2] + j * a->msize);
                                *sfm = *sfc;
+                               a->nr[2] = j + 1;
                        }
                }
        }