]> granicus.if.org Git - sysstat/commitdiff
Add option to display mountpoint names instead of filesystem names.
authorSteve Kay <stevekay@gmail.com>
Fri, 13 Mar 2015 22:24:10 +0000 (15:24 -0700)
committerSteve Kay <stevekay@gmail.com>
Fri, 13 Mar 2015 22:24:10 +0000 (15:24 -0700)
man/sar.in
pr_stats.c
rd_stats.c
rd_stats.h
sa.h
sa_common.c
sar.c

index 2519b433b5c03b38dbd5f50a21ca708a6041556a..41d50f332918582f26b6d06a9fca3a64c577a301 100644 (file)
@@ -348,16 +348,21 @@ Set the ending time of the report. The default ending time is
 18:00:00. Hours must be given in 24-hour format.
 This option can be used when data are read from
 or written to a file (options -f or -o).
-.IP -F
+.IP "-F [ MOUNT ]"
 Display statistics for currently mounted filesystems. Pseudo-filesystems are
-ignored. At the end of the report,
-.B sar
+ignored.  At the end of the report, 
+.B sar 
 will display a summary of all those filesystems.
 Note that filesystems statistics depend on
 .B sadc
 option
 .B "-S XDISK"
 to be collected.
+Use of the 
+.B MOUNT
+parameter keyword indicates that mountpoint will be reported instead of 
+filesystem device.
+
 The following values are displayed:
 
 .B MBfsfree
index 0c1d550aadbe4a1f54705ed6d49560bd9e6a28b2..d7754f4e514ba161c0e826800e54082196b7c701 100644 (file)
@@ -2500,11 +2500,11 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int curr, int di
        int i, j;
        struct stats_filesystem *sfc, *sfm;
 
-
        if (dis) {
                printf("\n%-11s  MBfsfree  MBfsused   %%fsused  %%ufsused"
-                      "     Ifree     Iused    %%Iused FILESYSTEM\n",
-                      (dispavg ? _("Summary:") : timestamp[!curr]));
+                      "     Ifree     Iused    %%Iused %s\n",
+                      (dispavg ? _("Summary:") : timestamp[!curr]),
+                      DISPLAY_MOUNT(a->opt_flags) ? _("MOUNTPOINT") : _("FILESYSTEM"));
        }
 
        for (i = 0; i < a->nr; i++) {
@@ -2528,7 +2528,7 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int curr, int di
                       sfc->f_files - sfc->f_ffree,
                       sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
                                    : 0.0,
-                      sfc->fs_name);
+                      DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name);
 
                if (!dispavg) {
                        /* Save current filesystem in summary list */
index faa33cc1335395330ab4a0a6f036415f5f87be83..dc3ac0dc03a3e2a296fae6ecfddbf43f2db3e276 100644 (file)
@@ -2098,6 +2098,7 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr)
                        st_filesystem_i->f_files  = buf.f_files;
                        st_filesystem_i->f_ffree  = buf.f_ffree;
                        strcpy(st_filesystem_i->fs_name, fs_name);
+                       strcpy(st_filesystem_i->mountp, mountp);
                }
        }
 
index c8248df15cca25beb648e59684a1cc816116da22..42f7ec317bdb28b322b54d439e14306dee96478c 100644 (file)
@@ -543,6 +543,7 @@ struct stats_filesystem {
        unsigned long long f_files              __attribute__ ((aligned (16)));
        unsigned long long f_ffree              __attribute__ ((aligned (16)));
        char               fs_name[MAX_FS_LEN]  __attribute__ ((aligned (16)));
+       char               mountp[MAX_FS_LEN]   __attribute__ ((aligned (16)));
 };
 
 #define STATS_FILESYSTEM_SIZE  (sizeof(struct stats_filesystem))
diff --git a/sa.h b/sa.h
index 6f7f9d607a505f4352a094c763b5b93d311cf2f7..51f97b2121403d302117f76d8739bc7d06f10906 100644 (file)
--- a/sa.h
+++ b/sa.h
 
 #define COLLECT_PARTITIONS(m)  (((m) & AO_F_DISK_PART)   == AO_F_DISK_PART)
 
+/* Output flags for option -F */
+#define AO_F_MOUNT             0x00000001
+
+#define DISPLAY_MOUNT(m)       (((m) & AO_F_MOUNT)       == AO_F_MOUNT)
+
 /*
  ***************************************************************************
  * Various keywords and constants.
index c86417b398e14692ff3e77d8514912957dd7345f..fcefb18ef8b67a9ed69b5c9f07fe846a82002db5 100644 (file)
@@ -1585,6 +1585,12 @@ int parse_sar_opt(char *argv[], int *opt, struct activity *act[],
 
                case 'F':
                        SELECT_ACTIVITY(A_FILESYSTEM);
+                       p = get_activity_position(act, A_FILESYSTEM, EXIT_IF_NOT_FOUND);
+                       if (!*(argv[*opt] + i + 1) && argv[*opt + 1] && !strcmp(argv[*opt + 1], "MOUNT")) {
+                               (*opt)++;
+                               act[p]->opt_flags |= AO_F_MOUNT;
+                               return 0;
+                       }
                        break;
 
                case 'H':
diff --git a/sar.c b/sar.c
index bab31a93bdf8d4983bf13e9f0bb896b074b9e247..3b93e2e5b8a32cff13061c7011c443b6ba38f718 100644 (file)
--- a/sar.c
+++ b/sar.c
@@ -107,9 +107,9 @@ void usage(char *progname)
 {
        print_usage_title(stderr, progname);
        fprintf(stderr, _("Options are:\n"
-                         "[ -A ] [ -B ] [ -b ] [ -C ] [ -D ] [ -d ] [ -F ] [ -H ] [ -h ] [ -p ] [ -q ]\n"
-                         "[ -R ] [ -r [ ALL ] ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -V ] [ -v ] [ -W ]\n"
-                         "[ -w ] [ -y ]\n"
+                         "[ -A ] [ -B ] [ -b ] [ -C ] [ -D ] [ -d ] [ -F [ MOUNTS ] ] [ -H ] [ -h ]\n"
+                         "[ -p ] [ -q ] [ -R ] [ -r [ ALL ] ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -V ]\n"
+                         "[ -v ] [ -W ] [ -w ] [ -y ]\n"
                          "[ -I { <int> [,...] | SUM | ALL | XALL } ] [ -P { <cpu> [,...] | ALL } ]\n"
                          "[ -m { <keyword> [,...] | ALL } ] [ -n { <keyword> [,...] | ALL } ]\n"
                          "[ -j { ID | LABEL | PATH | UUID | ... } ]\n"
@@ -133,7 +133,8 @@ void display_help(char *progname)
        printf(_("\t-B\tPaging statistics\n"));
        printf(_("\t-b\tI/O and transfer rate statistics\n"));
        printf(_("\t-d\tBlock devices statistics\n"));
-       printf(_("\t-F\tFilesystems statistics\n"));
+       printf(_("\t-F [ MOUNTS ]\n"));
+       printf(_("\t\tFilesystems statistics\n"));
        printf(_("\t-H\tHugepages utilization statistics\n"));
        printf(_("\t-I { <int> | SUM | ALL | XALL }\n"
                 "\t\tInterrupts statistics\n"));
@@ -170,7 +171,7 @@ void display_help(char *progname)
        printf(_("\t-q\tQueue length and load average statistics\n"));
        printf(_("\t-R\tMemory statistics\n"));
        printf(_("\t-r [ ALL ]\n"
-                "\tMemory utilization statistics\n"));
+                "\t\tMemory utilization statistics\n"));
        printf(_("\t-S\tSwap space utilization statistics\n"));
        printf(_("\t-u [ ALL ]\n"
                 "\t\tCPU utilization statistics\n"));