From be447b1125522d63b9f6b9006f01d9f20ee77a6c Mon Sep 17 00:00:00 2001 From: Sebastien Godard Date: Fri, 7 Jan 2011 14:46:37 +0100 Subject: [PATCH] Added --debuginfo option to cifsiostat and nfsiostat commands. 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. --- .gitignore | 2 ++ CHANGES | 3 +++ Makefile.in | 1 + cifsiostat.c | 29 ++++++++++++++++++++++++++++ cifsiostat.h | 2 ++ configure | 24 ++++++++++++++--------- configure.in | 2 ++ man/{cifsiostat.1 => cifsiostat.in} | 15 ++++++++++++++- man/{nfsiostat.1 => nfsiostat.in} | 15 ++++++++++++++- nfsiostat.c | 30 +++++++++++++++++++++++++++++ nfsiostat.h | 2 ++ nls/sysstat.pot | 11 +++++++++-- 12 files changed, 123 insertions(+), 13 deletions(-) rename man/{cifsiostat.1 => cifsiostat.in} (91%) rename man/{nfsiostat.1 => nfsiostat.in} (93%) diff --git a/.gitignore b/.gitignore index e4dbf15..f177fc4 100644 --- a/.gitignore +++ b/.gitignore @@ -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 fd2eded..4045799 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ Changes: xxxx/xx/xx: Version 10.0.0 - Sebastien Godard (sysstat 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. diff --git a/Makefile.in b/Makefile.in index c66e485..0a767d1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/cifsiostat.c b/cifsiostat.c index 9621945..8aeddae 100644 --- a/cifsiostat.c +++ b/cifsiostat.c @@ -69,8 +69,13 @@ void usage(char *progname) fprintf(stderr, _("Usage: %s [ options ] [ [ ] ]\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++) { diff --git a/cifsiostat.h b/cifsiostat.h index 6c84d0a..ea64610 100644 --- a/cifsiostat.h +++ b/cifsiostat.h @@ -17,12 +17,14 @@ #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 diff --git a/configure b/configure index b397d70..97cca30 100755 --- 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 ." _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" ;; diff --git a/configure.in b/configure.in index be300a8..d8f52cb 100644 --- a/configure.in +++ b/configure.in @@ -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) diff --git a/man/cifsiostat.1 b/man/cifsiostat.in similarity index 91% rename from man/cifsiostat.1 rename to man/cifsiostat.in index d588651..f687c7b 100644 --- a/man/cifsiostat.1 +++ b/man/cifsiostat.in @@ -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 diff --git a/man/nfsiostat.1 b/man/nfsiostat.in similarity index 93% rename from man/nfsiostat.1 rename to man/nfsiostat.in index d5ca985..b455296 100644 --- a/man/nfsiostat.1 +++ b/man/nfsiostat.in @@ -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 diff --git a/nfsiostat.c b/nfsiostat.c index f9efdbb..70cd931 100644 --- a/nfsiostat.c +++ b/nfsiostat.c @@ -68,8 +68,13 @@ void usage(char *progname) fprintf(stderr, _("Usage: %s [ options ] [ [ ] ]\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++) { diff --git a/nfsiostat.h b/nfsiostat.h index d08f40b..e2324e5 100644 --- a/nfsiostat.h +++ b/nfsiostat.h @@ -17,12 +17,14 @@ #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" diff --git a/nls/sysstat.pot b/nls/sysstat.pot index d57b0ee..b3c1052 100644 --- a/nls/sysstat.pot +++ b/nls/sysstat.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: sysstat 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 \n" "Language-Team: LANGUAGE \n" @@ -22,7 +22,14 @@ msgstr "" msgid "Usage: %s [ options ] [ [ ] ]\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" -- 2.40.0