[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5e766bd1ebd9f622c1f59646c06490ab6c5f023d.1607640819.git.me@pmachata.org>
Date: Fri, 11 Dec 2020 00:02:20 +0100
From: Petr Machata <me@...chata.org>
To: netdev@...r.kernel.org, dsahern@...il.com,
stephen@...workplumber.org
Cc: Petr Machata <me@...chata.org>
Subject: [PATCH iproute2-next 06/10] dcb: Add -s to enable statistics
Allow selective display of statistical counters by passing -s.
Signed-off-by: Petr Machata <me@...chata.org>
---
dcb/dcb.c | 9 +++++++--
dcb/dcb.h | 1 +
man/man8/dcb.8 | 5 +++++
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dcb/dcb.c b/dcb/dcb.c
index 7c0beee43686..9332a8b2e3d4 100644
--- a/dcb/dcb.c
+++ b/dcb/dcb.c
@@ -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;
diff --git a/dcb/dcb.h b/dcb/dcb.h
index d22176888811..b2a13b3065f2 100644
--- a/dcb/dcb.h
+++ b/dcb/dcb.h
@@ -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,
diff --git a/man/man8/dcb.8 b/man/man8/dcb.8
index f318435caa98..f853b7baaf33 100644
--- a/man/man8/dcb.8
+++ b/man/man8/dcb.8
@@ -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
--
2.25.1
Powered by blists - more mailing lists