|
|
72abff |
From 5c63cabf526ee93dec1aef7da6e17a46cbd5c562 Mon Sep 17 00:00:00 2001
|
|
|
72abff |
From: seb <sysstat@orange.fr.fake>
|
|
|
72abff |
Date: Mon, 6 May 2013 21:55:04 +0200
|
|
|
72abff |
Subject: [PATCH] Filesystems statistics for sar (part 3): Display statistics
|
|
|
72abff |
|
|
|
72abff |
This patch makes sar display filesystems statistics collected by sadc.
|
|
|
72abff |
No average statistics are calculated here (filesystems can be unmounted,
|
|
|
72abff |
then mounted again, making average values meaningless). Instead, sar displays again
|
|
|
72abff |
the list of filesystems.
|
|
|
72abff |
|
|
|
72abff |
(cherry picked from commit c8afab03c6a6a28e303613b203bf6c186c168524)
|
|
|
72abff |
---
|
|
|
72abff |
pr_stats.c | 34 +++++++++++++++++++++++++++++++++-
|
|
|
72abff |
1 file changed, 33 insertions(+), 1 deletion(-)
|
|
|
72abff |
|
|
|
72abff |
diff --git a/pr_stats.c b/pr_stats.c
|
|
|
72abff |
index 332b10e..85a3a20 100644
|
|
|
72abff |
--- a/pr_stats.c
|
|
|
72abff |
+++ b/pr_stats.c
|
|
|
72abff |
@@ -2454,7 +2454,39 @@ __print_funct_t print_avg_pwr_usb_stats(struct activity *a, int prev, int curr,
|
|
|
72abff |
__print_funct_t stub_print_filesystem_stats(struct activity *a, int prev, int curr,
|
|
|
72abff |
unsigned long long itv, int dispavg)
|
|
|
72abff |
{
|
|
|
72abff |
- /* FIXME */
|
|
|
72abff |
+ int i;
|
|
|
72abff |
+ struct stats_filesystem *sfc;
|
|
|
72abff |
+
|
|
|
72abff |
+
|
|
|
72abff |
+ if (dis) {
|
|
|
72abff |
+ printf("\n%-11s MBfsfree MBfsused %%fsused %%ufsused"
|
|
|
72abff |
+ " Ifree Iused %%Iused FILESYSTEM\n",
|
|
|
72abff |
+ (dispavg ? _("Summary") : timestamp[!curr]));
|
|
|
72abff |
+ }
|
|
|
72abff |
+
|
|
|
72abff |
+ for (i = 0; i < a->nr; i++) {
|
|
|
72abff |
+ sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
|
|
|
72abff |
+
|
|
|
72abff |
+ if (!sfc->f_blocks)
|
|
|
72abff |
+ /* Size of filesystem is null: We are at the end of the list */
|
|
|
72abff |
+ break;
|
|
|
72abff |
+
|
|
|
72abff |
+ printf("%-11s %9.0f %9.0f %6.2f %6.2f"
|
|
|
72abff |
+ " %9llu %9llu %6.2f %s\n",
|
|
|
72abff |
+ (dispavg ? _("Summary") : timestamp[curr]),
|
|
|
72abff |
+ (double) sfc->f_bfree / 1024 / 1024,
|
|
|
72abff |
+ (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024,
|
|
|
72abff |
+ /* f_blocks is not null. But test it anyway ;-) */
|
|
|
72abff |
+ sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
|
|
|
72abff |
+ : 0.0,
|
|
|
72abff |
+ sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
|
|
|
72abff |
+ : 0.0,
|
|
|
72abff |
+ sfc->f_ffree,
|
|
|
72abff |
+ sfc->f_files - sfc->f_ffree,
|
|
|
72abff |
+ sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
|
|
|
72abff |
+ : 0.0,
|
|
|
72abff |
+ sfc->fs_name);
|
|
|
72abff |
+ }
|
|
|
72abff |
}
|
|
|
72abff |
|
|
|
72abff |
/*
|
|
|
72abff |
--
|
|
|
72abff |
2.14.3
|
|
|
72abff |
|