diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2018-11-20 21:46:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2018-11-20 21:46:14 +0000 |
commit | 6bfc1a27011d44cbf915607feb276a847148dd30 (patch) | |
tree | b5c210382ec099c243df2c9c0624fac4c71ffa10 /examples | |
parent | e797b8a73237c951c91557389522362e6110b0f6 (diff) | |
parent | 1768c495416997c7a6769c6a92b33b37c89eed25 (diff) |
Merge "Rename skipzero flag to all"
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cmd/stats-api/stats_api.go | 8 |
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) |