1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

dmstats: add --notimesuffix switch

Add a switch to disable the printing of time unit suffixes in
histogram bounds descriptions.
This commit is contained in:
Bryn M. Reeves 2015-09-03 21:55:25 +01:00
parent f09e4f7b10
commit 84d88cb2cf
2 changed files with 12 additions and 2 deletions

View File

@ -79,6 +79,7 @@ dmstats \(em device-mapper statistics management
.RB [ \-\-units
.IR units ]
.RB [ \-\-nosuffix ]
.RB [ \-\-notimesuffix ]
.br
.B dmstats list
.RI [ device_name ]
@ -88,7 +89,7 @@ dmstats \(em device-mapper statistics management
.RB [ \-\-units
.IR units ]
.RB [ \-\-nosuffix ]
.RB [ \-\-nosuffix ]
.RB [ \-\-notimesuffix ]
.RB [ \-v | \-\-verbose \ [ \-v | \-\-verbose ]
.br
.B dmstats print
@ -121,6 +122,7 @@ dmstats \(em device-mapper statistics management
.RB [ \-\-units
.IR units ]
.RB [ \-\-nosuffix ]
.RB [ \-\-notimesuffix ]
.br
.ad b
.SH DESCRIPTION
@ -206,6 +208,10 @@ Specify the minor number.
Suppress the suffix on output sizes. Use with \fB\-\-units\fP
(except h and H) if processing the output.
.TP
.B \-\-notimesuffix
Suppress the suffix on output time values. Histogram boundary values
will be reported in units of nanoseconds.
.TP
.BR \-o | \-\-options
Specify which report fields to display.
.TP

View File

@ -187,6 +187,7 @@ enum {
NOOPENCOUNT_ARG,
NOSUFFIX_ARG,
NOTABLE_ARG,
NOTIMESUFFIX_ARG,
UDEVCOOKIE_ARG,
NOUDEVRULES_ARG,
NOUDEVSYNC_ARG,
@ -3456,7 +3457,7 @@ static const char *_get_histogram_string(const struct dm_stats *dms, int rel,
flags |= (rel) ? DM_HISTOGRAM_PERCENT
: 0;
flags |= DM_HISTOGRAM_SUFFIX;
flags |= (_switches[NOTIMESUFFIX_ARG]) ? 0 : DM_HISTOGRAM_SUFFIX;
/* FIXME: make unit conversion optional. */
return dm_histogram_to_string(dmh, -1, 0, flags);
@ -5704,6 +5705,7 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
{"noopencount", 0, &ind, NOOPENCOUNT_ARG},
{"nosuffix", 0, &ind, NOSUFFIX_ARG},
{"notable", 0, &ind, NOTABLE_ARG},
{"notimesuffix", 0, &ind, NOTIMESUFFIX_ARG},
{"udevcookie", 1, &ind, UDEVCOOKIE_ARG},
{"noudevrules", 0, &ind, NOUDEVRULES_ARG},
{"noudevsync", 0, &ind, NOUDEVSYNC_ARG},
@ -5857,6 +5859,8 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
_switches[NOSUFFIX_ARG]++;
if (c == 'n' || ind == NOTABLE_ARG)
_switches[NOTABLE_ARG]++;
if (ind == NOTIMESUFFIX_ARG)
_switches[NOTIMESUFFIX_ARG]++;
if (c == 'o' || ind == OPTIONS_ARG) {
_switches[OPTIONS_ARG]++;
_string_args[OPTIONS_ARG] = optarg;