]> granicus.if.org Git - sysstat/commitdiff
Added --debuginfo option to cifsiostat and nfsiostat commands.
authorSebastien Godard <sysstat@orange.fr>
Fri, 7 Jan 2011 13:46:37 +0000 (14:46 +0100)
committerSebastien Godard <sysstat@orange.fr>
Fri, 7 Jan 2011 13:46:37 +0000 (14:46 +0100)
Jan Kaluza from Redhat (jkaluza@redhat.com) added option --debuginfo
to cifsiostat and nfsiostat commands.

His mail (06/30/2010):

Hi,

thanks for applying my previous patch in Sysstat 9.1.3 (I'm really proud to be
in the Changelog). I've created another patch which adds --debuginfo option
also for new tools (nfsiostat, cifsiostat) introduced in this release. I think
it could help debugging in some situations. Please feel free to ask any
question about that patch.

Jan Kaluza

cifsiostat and nfsiostat manual pages have also been updated.

12 files changed:
.gitignore
CHANGES
Makefile.in
cifsiostat.c
cifsiostat.h
configure
configure.in
man/cifsiostat.in [moved from man/cifsiostat.1 with 91% similarity]
man/nfsiostat.in [moved from man/nfsiostat.1 with 93% similarity]
nfsiostat.c
nfsiostat.h
nls/sysstat.pot

index e4dbf15b562207bbc48c73c5a545c57eef336c05..f177fc446be9f55f7f0a8fa05231054453ca7513 100644 (file)
@@ -22,6 +22,8 @@ man/sysstat.5
 man/sadf.1
 man/sar.1
 man/iostat.1
+man/cifsiostat.1
+man/nfsiostat.1
 *.log
 config.status
 autom4te.cache/
diff --git a/CHANGES b/CHANGES
index fd2ededccca2c81cb8e577d5dd4af8e1190119d5..40457990f7750fd97ff66747ab135849cfc4bfda 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
 Changes:
 
 xxxx/xx/xx: Version 10.0.0 - Sebastien Godard (sysstat <at> orange.fr)
+       * [Jan Kaluza]: Added --debuginfo option to cifsiostat.
+       * [Jan Kaluza]: Added --debuginfo option to nfsiostat.
+       * cifsiostat and nfsiostat manual pages updated.
        * sysstat_panic function is now defined only in DEBUG mode.
        * NLS updated. Ukrainian translation added.
 
index c66e485f214de5ccf04bdbbf8e77a23d8e9f50a4..0a767d1d5831f2236a55f5c30c9ee2590e048d80 100644 (file)
@@ -589,6 +589,7 @@ almost-distclean: clean nls/sysstat.pot
        rm -f cron/sysstat.cron.hourly cron/sysstat.crond.sample cron/sysstat.crond.sample.in
        rm -f contrib/isag/isag
        rm -f man/sa1.8 man/sa2.8 man/sadc.8 man/sadf.1 man/sar.1 man/iostat.1 man/sysstat.5
+       rm -f man/cifsiostat.1 man/nfsiostat.1
        rm -f *.log config.status
        rm -rf autom4te.cache
        rm -f *.save *.old .*.swp data
index 96219458b3fc210e748527cbc612c804dcfcd175..8aeddae35505bf9e3135d1161c9015ef8516063b 100644 (file)
@@ -69,8 +69,13 @@ void usage(char *progname)
        fprintf(stderr, _("Usage: %s [ options ] [ <interval> [ <count> ] ]\n"),
                progname);
 
+#ifdef DEBUG
+       fprintf(stderr, _("Options are:\n"
+                         "[ --debuginfo ] [ -h ] [ -k | -m ] [ -t ] [ -V ]\n"));
+#else
        fprintf(stderr, _("Options are:\n"
                          "[ -h ] [ -k | -m ] [ -t ] [ -V ]\n"));
+#endif
        exit(1);
 }
 
@@ -406,6 +411,11 @@ void write_stats(int curr, struct tm *rectime)
                        strftime(timestamp, sizeof(timestamp), "%x %X", rectime);
                }
                printf("%s\n", timestamp);
+#ifdef DEBUG
+               if (DISPLAY_DEBUG(flags)) {
+                       fprintf(stderr, "%s\n", timestamp);
+               }
+#endif
        }
 
        /* Interval is multiplied by the number of processors */
@@ -425,6 +435,19 @@ void write_stats(int curr, struct tm *rectime)
                if (shi->used) {
                        ioni = st_cifs[curr]  + i;
                        ionj = st_cifs[!curr] + i;
+#ifdef DEBUG
+                       if (DISPLAY_DEBUG(flags)) {
+                               /* Debug output */
+                               fprintf(stderr, "name=%s itv=%llu fctr=%d ioni{ rd_bytes=%llu "
+                                               "wr_bytes=%llu rd_ops=%llu wr_ops=%llu fopens=%llu "
+                                               "fcloses=%llu fdeletes=%llu}\n",
+                                       shi->name, itv, fctr,
+                                       ioni->rd_bytes, ioni->wr_bytes,
+                                       ioni->rd_ops,   ioni->wr_ops,
+                                       ioni->fopens,   ioni->fcloses,
+                                       ioni->fdeletes);
+                       }
+#endif
                        write_cifs_stat(curr, itv, fctr, shi, ioni, ionj);
                }
        }
@@ -503,6 +526,12 @@ int main(int argc, char **argv)
        /* Process args... */
        while (opt < argc) {
 
+#ifdef DEBUG
+               if (!strcmp(argv[opt], "--debuginfo")) {
+                       flags |= I_D_DEBUG;
+                       opt++;
+               } else
+#endif
                if (!strncmp(argv[opt], "-", 1)) {
                        for (i = 1; *(argv[opt] + i); i++) {
 
index 6c84d0a266457e6d6adec6d7c76bda1cd70a7a61..ea64610841e6c1c1089ed2179cc6e8e9d466211d 100644 (file)
 #define I_D_MEGABYTES          0x004
 #define I_D_ISO                        0x008
 #define I_D_HUMAN_READ         0x010
+#define I_D_DEBUG              0x020
 
 #define DISPLAY_TIMESTAMP(m)   (((m) & I_D_TIMESTAMP)     == I_D_TIMESTAMP)
 #define DISPLAY_KILOBYTES(m)   (((m) & I_D_KILOBYTES)     == I_D_KILOBYTES)
 #define DISPLAY_MEGABYTES(m)   (((m) & I_D_MEGABYTES)     == I_D_MEGABYTES)
 #define DISPLAY_ISO(m)         (((m) & I_D_ISO)           == I_D_ISO)
 #define DISPLAY_HUMAN_READ(m)  (((m) & I_D_HUMAN_READ)    == I_D_HUMAN_READ)
+#define DISPLAY_DEBUG(m)       (((m) & I_D_DEBUG)         == I_D_DEBUG)
 
 /* Preallocation constats */
 #define NR_CIFS_PREALLOC       2
index b397d708497060ab959e4c68b60440e5b430bc0c..97cca303a7a651cc2cacbedea29c4fc7a767fd14 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for sysstat 9.1.7.
+# Generated by GNU Autoconf 2.63 for sysstat 10.0.0.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@@ -594,8 +594,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='sysstat'
 PACKAGE_TARNAME='sysstat'
-PACKAGE_VERSION='9.1.7'
-PACKAGE_STRING='sysstat 9.1.7'
+PACKAGE_VERSION='10.0.0'
+PACKAGE_STRING='sysstat 10.0.0'
 PACKAGE_BUGREPORT=''
 
 ac_unique_file="ioconf.h"
@@ -1318,7 +1318,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures sysstat 9.1.7 to adapt to many kinds of systems.
+\`configure' configures sysstat 10.0.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1379,7 +1379,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of sysstat 9.1.7:";;
+     short | recursive ) echo "Configuration of sysstat 10.0.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1486,7 +1486,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sysstat configure 9.1.7
+sysstat configure 10.0.0
 generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1500,7 +1500,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by sysstat $as_me 9.1.7, which was
+It was created by sysstat $as_me 10.0.0, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
@@ -7790,6 +7790,10 @@ ac_config_files="$ac_config_files man/sysstat.5:man/sysstat.in"
        # File must be renamed
 ac_config_files="$ac_config_files man/iostat.1:man/iostat.in"
        # File must be renamed
+ac_config_files="$ac_config_files man/cifsiostat.1:man/cifsiostat.in"
+       # File must be renamed
+ac_config_files="$ac_config_files man/nfsiostat.1:man/nfsiostat.in"
+       # File must be renamed
 ac_config_files="$ac_config_files contrib/isag/isag"
  # Permissions must be changed
 
@@ -8250,7 +8254,7 @@ exec 6>&1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by sysstat $as_me 9.1.7, which was
+This file was extended by sysstat $as_me 10.0.0, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -8300,7 +8304,7 @@ Report bugs to <bug-autoconf@gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-sysstat config.status 9.1.7
+sysstat config.status 10.0.0
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -8421,6 +8425,8 @@ do
     "man/sar.1") CONFIG_FILES="$CONFIG_FILES man/sar.1:man/sar.in" ;;
     "man/sysstat.5") CONFIG_FILES="$CONFIG_FILES man/sysstat.5:man/sysstat.in" ;;
     "man/iostat.1") CONFIG_FILES="$CONFIG_FILES man/iostat.1:man/iostat.in" ;;
+    "man/cifsiostat.1") CONFIG_FILES="$CONFIG_FILES man/cifsiostat.1:man/cifsiostat.in" ;;
+    "man/nfsiostat.1") CONFIG_FILES="$CONFIG_FILES man/nfsiostat.1:man/nfsiostat.in" ;;
     "contrib/isag/isag") CONFIG_FILES="$CONFIG_FILES contrib/isag/isag" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
index be300a8b86a0ffe8bd2cb55f79a3e55ea73e68b5..d8f52cb15446151aff0c0681f5cdb1ddb4188aa6 100644 (file)
@@ -508,6 +508,8 @@ AC_CONFIG_FILES([man/sadf.1:man/sadf.in])   # File must be renamed
 AC_CONFIG_FILES([man/sar.1:man/sar.in])                # File must be renamed
 AC_CONFIG_FILES([man/sysstat.5:man/sysstat.in])        # File must be renamed
 AC_CONFIG_FILES([man/iostat.1:man/iostat.in])  # File must be renamed
+AC_CONFIG_FILES([man/cifsiostat.1:man/cifsiostat.in])  # File must be renamed
+AC_CONFIG_FILES([man/nfsiostat.1:man/nfsiostat.in])    # File must be renamed
 AC_CONFIG_FILES([contrib/isag/isag], [chmod +x contrib/isag/isag]) # Permissions must be changed
 
 AC_OUTPUT(Makefile)
similarity index 91%
rename from man/cifsiostat.1
rename to man/cifsiostat.in
index d5886510f39be2d65756298c43fdff213d10c373..f687c7bba2cc3f2678b09e1ccdcd891435c2c376 100644 (file)
@@ -1,12 +1,21 @@
-.TH CIFSIOSTAT 1 "JULY 2010" Linux "Linux User's Manual" -*- nroff -*-
+.TH CIFSIOSTAT 1 "JANUARY 2011" Linux "Linux User's Manual" -*- nroff -*-
 .SH NAME
 cifsiostat \- Report CIFS statistics.
 .SH SYNOPSIS
+.ie 'yes'@WITH_DEBUG@' \{
+.B cifsiostat [ --debuginfo ] [ -h ] [ -k | -m ] [ -t ] [ -V ] [
+.I interval
+.B [
+.I count
+.B ] ]
+.\}
+.el \{
 .B cifsiostat [ -h ] [ -k | -m ] [ -t ] [ -V ] [
 .I interval
 .B [
 .I count
 .B ] ]
+.\}
 .SH DESCRIPTION
 The
 .B cifsiostat
@@ -86,6 +95,10 @@ Indicate the number of deleted files per second.
 .RE
 .RE
 .SH OPTIONS
+.if 'yes'@WITH_DEBUG@' \{
+.IP --debuginfo
+Print debug output to stderr.
+.\}
 .IP -h
 Make the CIFS report easier to read by a human.
 .IP -k
similarity index 93%
rename from man/nfsiostat.1
rename to man/nfsiostat.in
index d5ca985236331eee79d7d78e755a176ce15eb4fd..b45529648dab6919b4cefb43024b233e2552a8cd 100644 (file)
@@ -1,12 +1,21 @@
-.TH NFSIOSTAT 1 "DECEMBER 2010" Linux "Linux User's Manual" -*- nroff -*-
+.TH NFSIOSTAT 1 "JANUARY 2011" Linux "Linux User's Manual" -*- nroff -*-
 .SH NAME
 nfsiostat \- Report input/output statistics for network filesystems (NFS).
 .SH SYNOPSIS
+.ie 'yes'@WITH_DEBUG@' \{
+.B nfsiostat [ --debuginfo ] [ -h ] [ -k | -m ] [ -t ] [ -V ] [
+.I interval
+.B [
+.I count
+.B ] ]
+.\}
+.el \{
 .B nfsiostat [ -h ] [ -k | -m ] [ -t ] [ -V ] [
 .I interval
 .B [
 .I count
 .B ] ]
+.\}
 .SH DESCRIPTION
 The
 .B nfsiostat
@@ -107,6 +116,10 @@ per second.
 .RE
 .RE
 .SH OPTIONS
+.if 'yes'@WITH_DEBUG@' \{
+.IP --debuginfo
+Print debug output to stderr.
+.\}
 .IP -h
 Make the NFS report easier to read by a human.
 .IP -k
index f9efdbbc5aabc401d7f659fd6aa552c115425067..70cd93117abbefb8d653954a45e6f6d6a3bcec84 100644 (file)
@@ -68,8 +68,13 @@ void usage(char *progname)
        fprintf(stderr, _("Usage: %s [ options ] [ <interval> [ <count> ] ]\n"),
                progname);
 
+#ifdef DEBUG
+       fprintf(stderr, _("Options are:\n"
+                         "[ --debuginfo ] [ -h ] [ -k | -m ] [ -t ] [ -V ]\n"));
+#else
        fprintf(stderr, _("Options are:\n"
                          "[ -h ] [ -k | -m ] [ -t ] [ -V ]\n"));
+#endif
        exit(1);
 }
 
@@ -483,6 +488,11 @@ void write_stats(int curr, struct tm *rectime)
                        strftime(timestamp, sizeof(timestamp), "%x %X", rectime);
                }
                printf("%s\n", timestamp);
+#ifdef DEBUG
+               if (DISPLAY_DEBUG(flags)) {
+                       fprintf(stderr, "%s\n", timestamp);
+               }
+#endif
        }
 
        /* Interval is multiplied by the number of processors */
@@ -502,6 +512,20 @@ void write_stats(int curr, struct tm *rectime)
                if (shi->used) {
                        ioni = st_ionfs[curr]  + i;
                        ionj = st_ionfs[!curr] + i;
+#ifdef DEBUG
+                       if (DISPLAY_DEBUG(flags)) {
+                               /* Debug output */
+                               fprintf(stderr, "name=%s itv=%llu fctr=%d ioni{ rd_normal_bytes=%llu "
+                                               "wr_normal_bytes=%llu rd_direct_bytes=%llu wr_direct_bytes=%llu rd_server_bytes=%llu "
+                                               "wr_server_bytes=%llu rpc_sends=%lu nfs_rops=%lu nfs_wops=%lu }\n",
+                                       shi->name, itv, fctr,
+                                       ioni->rd_normal_bytes, ioni->wr_normal_bytes,
+                                       ioni->rd_direct_bytes, ioni->wr_direct_bytes,
+                                       ioni->rd_server_bytes, ioni->wr_server_bytes,
+                                       ioni->rpc_sends,
+                                       ioni->nfs_rops,        ioni->nfs_wops);
+                       }
+#endif
                        write_nfs_stat(curr, itv, fctr, shi, ioni, ionj);
                }
        }
@@ -580,6 +604,12 @@ int main(int argc, char **argv)
        /* Process args... */
        while (opt < argc) {
 
+#ifdef DEBUG
+               if (!strcmp(argv[opt], "--debuginfo")) {
+                       flags |= I_D_DEBUG;
+                       opt++;
+               } else
+#endif
                if (!strncmp(argv[opt], "-", 1)) {
                        for (i = 1; *(argv[opt] + i); i++) {
 
index d08f40b3ed3d96438b04bff61e7918e3cb69b5d7..e2324e52e35153a5b60de9a10bd9b0844e457243 100644 (file)
 #define I_D_MEGABYTES          0x004
 #define I_D_ISO                        0x008
 #define I_D_HUMAN_READ         0x010
+#define I_D_DEBUG              0x020
 
 #define DISPLAY_TIMESTAMP(m)   (((m) & I_D_TIMESTAMP)     == I_D_TIMESTAMP)
 #define DISPLAY_KILOBYTES(m)   (((m) & I_D_KILOBYTES)     == I_D_KILOBYTES)
 #define DISPLAY_MEGABYTES(m)   (((m) & I_D_MEGABYTES)     == I_D_MEGABYTES)
 #define DISPLAY_ISO(m)         (((m) & I_D_ISO)           == I_D_ISO)
 #define DISPLAY_HUMAN_READ(m)  (((m) & I_D_HUMAN_READ)    == I_D_HUMAN_READ)
+#define DISPLAY_DEBUG(m)       (((m) & I_D_DEBUG)         == I_D_DEBUG)
 
 /* Environment variable */
 #define ENV_POSIXLY_CORRECT    "POSIXLY_CORRECT"
index d57b0ee29cc8a2da3981d375579d79ec50903504..b3c1052505d90110536046deda6fca6081941448 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: sysstat <at> orange.fr\n"
-"POT-Creation-Date: 2010-12-24 15:16+0100\n"
+"POT-Creation-Date: 2011-01-07 14:45+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -22,7 +22,14 @@ msgstr ""
 msgid "Usage: %s [ options ] [ <interval> [ <count> ] ]\n"
 msgstr ""
 
-#: cifsiostat.c:72 nfsiostat.c:71
+#: cifsiostat.c:73 nfsiostat.c:72
+#, c-format
+msgid ""
+"Options are:\n"
+"[ --debuginfo ] [ -h ] [ -k | -m ] [ -t ] [ -V ]\n"
+msgstr ""
+
+#: cifsiostat.c:76 nfsiostat.c:75
 #, c-format
 msgid ""
 "Options are:\n"