dcb: Add -s to enable statistics
Allow selective display of statistical counters by passing -s. Signed-off-by: Petr Machata <me@pmachata.org> Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
11a72186a0
commit
6e9687db04
|
|
@ -310,7 +310,8 @@ static void dcb_help(void)
|
|||
"Usage: dcb [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
||||
" dcb [ -f | --force ] { -b | --batch } filename [ -N | --Netns ] netnsname\n"
|
||||
"where OBJECT := ets\n"
|
||||
" OPTIONS := [ -V | --Version | -j | --json | -p | --pretty | -v | --verbose ]\n");
|
||||
" OPTIONS := [ -V | --Version | -j | --json | -p | --pretty\n"
|
||||
" | -s | --statistics | -v | --verbose ]\n");
|
||||
}
|
||||
|
||||
static int dcb_cmd(struct dcb *dcb, int argc, char **argv)
|
||||
|
|
@ -346,6 +347,7 @@ int main(int argc, char **argv)
|
|||
{ "batch", required_argument, NULL, 'b' },
|
||||
{ "json", no_argument, NULL, 'j' },
|
||||
{ "pretty", no_argument, NULL, 'p' },
|
||||
{ "statistics", no_argument, NULL, 's' },
|
||||
{ "Netns", required_argument, NULL, 'N' },
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
|
|
@ -363,7 +365,7 @@ int main(int argc, char **argv)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "b:fhjpvN:V",
|
||||
while ((opt = getopt_long(argc, argv, "b:fhjpsvN:V",
|
||||
long_options, NULL)) >= 0) {
|
||||
|
||||
switch (opt) {
|
||||
|
|
@ -383,6 +385,9 @@ int main(int argc, char **argv)
|
|||
case 'p':
|
||||
pretty = true;
|
||||
break;
|
||||
case 's':
|
||||
dcb->stats = true;
|
||||
break;
|
||||
case 'N':
|
||||
if (netns_switch(optarg)) {
|
||||
ret = EXIT_FAILURE;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ struct dcb {
|
|||
char *buf;
|
||||
struct mnl_socket *nl;
|
||||
bool json_output;
|
||||
bool stats;
|
||||
};
|
||||
|
||||
int dcb_parse_mapping(const char *what_key, __u32 key, __u32 max_key,
|
||||
|
|
|
|||
|
|
@ -51,6 +51,11 @@ Generate JSON output.
|
|||
.BR "\-p" , " --pretty"
|
||||
When combined with -j generate a pretty JSON output.
|
||||
|
||||
.TP
|
||||
.BR "\-s" , " --statistics"
|
||||
If the object in question contains any statistical counters, shown them as
|
||||
part of the "show" output.
|
||||
|
||||
.SH OBJECTS
|
||||
|
||||
.TP
|
||||
|
|
|
|||
Loading…
Reference in New Issue