From bd65d249e944a3a1fad72088e4ad0c49c8458b81 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Fri, 19 Jan 2018 16:10:14 +0100 Subject: [PATCH] sar: Display all items for USB and filesystems activities 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 --- pr_stats.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pr_stats.c b/pr_stats.c index 59aac5a..e1d06cc 100644 --- a/pr_stats.c +++ b/pr_stats.c @@ -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; } } } -- 2.50.0