[PATCH] Add -v for being more verbose on non-fatal errors
authorJens Axboe <axboe@suse.de>
Fri, 7 Oct 2005 10:49:17 +0000 (12:49 +0200)
committerJens Axboe <axboe@suse.de>
Fri, 7 Oct 2005 10:49:17 +0000 (12:49 +0200)
Move version to -V instead.

README
blkparse.c
blktrace.c
doc/blktrace.tex

diff --git a/README b/README
index bc8acf1326cbb627199897b5b0efdc37c656a39e..a503b371b67055a04991977dbea23af62c41da20 100644 (file)
--- a/README
+++ b/README
@@ -58,9 +58,9 @@ $ blktrace -d <dev> [ -r relay_path ] [ -o output ] [ -k ] [ -w time ]
 
        -A Give the trace mask directly as a number.
 
-       -v Print program version info.
        -b Sub buffer size in KiB.
        -n Number of sub buffers.
+       -V Print program version info.
 
 $ blkparse -i <input> [ -o <output> ] [ -b rb_batch ] [ -s ] [ -t ] [ -q ]
                      [ -w start:stop ] [ -f output format ] [ -F format spec ]
@@ -117,8 +117,8 @@ $ blkparse -i <input> [ -o <output> ] [ -b rb_batch ] [ -s ] [ -t ] [ -q ]
                W       - Bounce
                X       - Split
 
-       -m Print missing entries.
-       -v Print program version info.
+       -v More verbose for marginal errors.
+       -V Print program version info.
 
 $ verify_blkparse filename
 
index 91174e2ca3bae18bc2794a9210d4eb28bf1495e5..4717c242dcb736da378e92943d6123dca8fec3e3 100644 (file)
@@ -81,7 +81,7 @@ static struct per_process_info *ppi_hash_table[PPI_HASH_SIZE];
 static struct per_process_info *ppi_list;
 static int ppi_list_entries;
 
-#define S_OPTS "a:A:i:o:b:stqw:f:F:vnmD:"
+#define S_OPTS "a:A:i:o:b:stqw:f:F:vVnD:"
 static struct option l_opts[] = {
        {
                .name = "act-mask",
@@ -156,16 +156,16 @@ static struct option l_opts[] = {
                .val = 'n'
        },
        {
-               .name = "missing",
+               .name = "verbose",
                .has_arg = no_argument,
                .flag = NULL,
-               .val = 'm'
+               .val = 'v'
        },
        {
                .name = "version",
                .has_arg = no_argument,
                .flag = NULL,
-               .val = 'v'
+               .val = 'V'
        },
        {
                .name = "input-directory",
@@ -230,7 +230,7 @@ static unsigned long long stopwatch_end = ULONG_LONG_MAX;   /* "infinity" */
 static int per_process_stats;
 static int track_ios;
 static int ppi_hash_by_pid = 1;
-static int print_missing;
+static int verbose;
 static unsigned int act_mask = -1U;
 
 static unsigned int t_alloc_cache;
@@ -513,9 +513,10 @@ static void log_track_frontmerge(struct per_dev_info *pdi,
 
        iot = __find_track(pdi, t->sector + t_sec(t));
        if (!iot) {
-               fprintf(stderr, "merge not found for (%d,%d): %llu\n",
-                       MAJOR(pdi->dev), MINOR(pdi->dev),
-                       (unsigned long long) t->sector + t_sec(t));
+               if (verbose)
+                       fprintf(stderr, "merge not found for (%d,%d): %llu\n",
+                               MAJOR(pdi->dev), MINOR(pdi->dev),
+                               (unsigned long long) t->sector + t_sec(t));
                return;
        }
 
@@ -582,9 +583,10 @@ static unsigned long long log_track_issue(struct per_dev_info *pdi,
 
        iot = __find_track(pdi, t->sector);
        if (!iot) {
-               fprintf(stderr, "issue not found for (%d,%d): %llu\n",
-                       MAJOR(pdi->dev), MINOR(pdi->dev),
-                       (unsigned long long) t->sector);
+               if (verbose)
+                       fprintf(stderr, "issue not found for (%d,%d): %llu\n",
+                               MAJOR(pdi->dev), MINOR(pdi->dev),
+                               (unsigned long long) t->sector);
                return -1;
        }
 
@@ -618,9 +620,10 @@ static unsigned long long log_track_complete(struct per_dev_info *pdi,
 
        iot = __find_track(pdi, t->sector);
        if (!iot) {
-               fprintf(stderr, "complete not found for (%d,%d): %llu\n",
-                       MAJOR(pdi->dev), MINOR(pdi->dev),
-                       (unsigned long long) t->sector);
+               if (verbose)
+                       fprintf(stderr,"complete not found for (%d,%d): %llu\n",
+                               MAJOR(pdi->dev), MINOR(pdi->dev),
+                               (unsigned long long) t->sector);
                return -1;
        }
 
@@ -1370,7 +1373,7 @@ static int check_sequence(struct per_dev_info *pdi, struct trace *t, int force)
                return 1;
        } else {
 skip:
-               if (print_missing) {
+               if (verbose) {
                        fprintf(stderr, "(%d,%d): skipping %lu -> %u\n",
                                MAJOR(pdi->dev), MINOR(pdi->dev),
                                pdi->last_sequence, bit->sequence);
@@ -1704,8 +1707,8 @@ static char usage_str[] = \
        "\t -f Output format. Customize the output format. The format field\n" \
        "\t    identifies can be found in the documentation\n" \
        "\t-F Format specification. Can be found in the documentation\n" \
-       "\t-m Print missing entries\n" \
-       "\t-v Print program version info\n\n";
+       "\t-v More verbose for marginal errors\n" \
+       "\t-V Print program version info\n\n";
 
 static void usage(char *prog)
 {
@@ -1781,10 +1784,10 @@ int main(int argc, char *argv[])
                case 'n':
                        ppi_hash_by_pid = 0;
                        break;
-               case 'm':
-                       print_missing = 1;
-                       break;
                case 'v':
+                       verbose++;
+                       break;
+               case 'V':
                        printf("%s version %s\n", argv[0], blkparse_version);
                        return 0;
                default:
index 48065d12d11e084a0aa35bdaa5e629898f33cc15..6d5d9538a5e6e6137de4131cf3dd9ed55030866e 100644 (file)
@@ -44,7 +44,7 @@ static char blktrace_version[] = "0.90";
 
 #define RELAYFS_TYPE   0xF0B4A981
 
-#define S_OPTS "d:a:A:r:o:kw:vb:n:D:"
+#define S_OPTS "d:a:A:r:o:kw:Vb:n:D:"
 static struct option l_opts[] = {
        {
                .name = "dev",
@@ -92,7 +92,7 @@ static struct option l_opts[] = {
                .name = "version",
                .has_arg = no_argument,
                .flag = NULL,
-               .val = 'v'
+               .val = 'V'
        },
        {
                .name = "buffer-size",
@@ -708,7 +708,7 @@ int main(int argc, char *argv[])
                                return 1;
                        }
                        break;
-               case 'v':
+               case 'V':
                        printf("%s version %s\n", argv[0], blktrace_version);
                        return 0;
                case 'b':
index 0ebbdd302f471076c02c1513ff44b7dafc38cfc3..78215b69bdc654b0522cc9cfc6cd737d10cd1d1e 100644 (file)
@@ -389,7 +389,7 @@ Short              & Long                       & Description \\ \hline\hline
 -n \emph{num-sub}  & --num-sub=\emph{num-sub}   & Specifies number of buffers to use \\ \hline
 -o \emph{file}     & --output=\emph{file}       & Prepend \emph{file} to output file name(s) \\ \hline
 -r \emph{rel-path} & --relay=\emph{rel-path}    & Specifies RelayFS mount point \\ \hline
--v                 & --version                  & Outputs version \\ \hline
+-V                 & --version                  & Outputs version \\ \hline
 -w \emph{seconds}  & --stopwatch=\emph{seconds} & Sets run time to the number of seconds specified \\ \hline
 \end{tabular}
 
@@ -497,7 +497,8 @@ Short              & Long                       & Description \\ \hline\hline
                   &                            & \emph{start:end-time} -- Display traces from time \emph{start} \\
                   &                            & through {end-time} (in ns). \\ \hline
 
--v                 & --version                  & Display version \\ \hline
+-v                 & --verbose                  & More verbose marginal on marginal errors \\ \hline
+-V                 & --version                  & Display version \\ \hline
 
 \end{tabular}