summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2018-11-17 19:40:24 +0100
committerOndrej Fabry <ofabry@cisco.com>2018-11-17 19:40:24 +0100
commit1768c495416997c7a6769c6a92b33b37c89eed25 (patch)
tree7cf092844c1d837da0a03914e0b74e7e69942535 /examples
parent6f8fd1541b33f280854e3d8341b8a342aca03fc9 (diff)
Rename skipzero flag to all
Change-Id: I3ec848c3c7ba00481f6642c01e446bba935abf5b Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/cmd/stats-api/stats_api.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/cmd/stats-api/stats_api.go b/examples/cmd/stats-api/stats_api.go
index bded8fd..6fd46d2 100644
--- a/examples/cmd/stats-api/stats_api.go
+++ b/examples/cmd/stats-api/stats_api.go
@@ -34,7 +34,7 @@ import (
var (
statsSocket = flag.String("socket", vppapiclient.DefaultStatSocket, "VPP stats segment socket")
- skipZeros = flag.Bool("skipzero", true, "Skip stats with zero values")
+ dumpAll = flag.Bool("all", false, "Dump all stats including ones with zero values")
)
func init() {
@@ -72,7 +72,7 @@ func main() {
switch cmd {
case "dump":
- dumpStats(client, patterns)
+ dumpStats(client, patterns, !*dumpAll)
default:
listStats(client, patterns)
}
@@ -93,7 +93,7 @@ func listStats(client adapter.StatsAPI, patterns []string) {
fmt.Printf("Listed %d stats\n", len(list))
}
-func dumpStats(client adapter.StatsAPI, patterns []string) {
+func dumpStats(client adapter.StatsAPI, patterns []string, skipZeros bool) {
fmt.Printf("Dumping stats.. %s\n", strings.Join(patterns, " "))
stats, err := client.DumpStats(patterns...)
@@ -103,7 +103,7 @@ func dumpStats(client adapter.StatsAPI, patterns []string) {
n := 0
for _, stat := range stats {
- if isZero(stat.Data) && *skipZeros {
+ if isZero(stat.Data) && skipZeros {
continue
}
fmt.Printf(" - %-25s %25v %+v\n", stat.Name, stat.Type, stat.Data)