diff options
author | Bert Muthalaly <stijlist@google.com> | 2019-01-08 12:34:08 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-01-08 12:35:35 -0800 |
commit | 3f45878b7323697c82e06649144e2a4f39018a12 (patch) | |
tree | 21d233748a2b0ab2ea9be12bb48f1acaceabed9f /pkg/tcpip/tcpip.go | |
parent | 5ce542ecc749cb9a1e8d216c7181aeaebfbc3110 (diff) |
Implement Stringer for tcpip.StatCounter
This enables formatting tcpip.Stats readably with %+v.
PiperOrigin-RevId: 228379088
Change-Id: I6a9876454a22f151ee752cf94589b4188729458f
Diffstat (limited to 'pkg/tcpip/tcpip.go')
-rw-r--r-- | pkg/tcpip/tcpip.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/tcpip/tcpip.go b/pkg/tcpip/tcpip.go index 7d4fbe075..fef5ba0e4 100644 --- a/pkg/tcpip/tcpip.go +++ b/pkg/tcpip/tcpip.go @@ -568,6 +568,10 @@ func (s *StatCounter) IncrementBy(v uint64) { atomic.AddUint64(&s.count, v) } +func (s *StatCounter) String() string { + return strconv.FormatUint(s.Value(), 10) +} + // IPStats collects IP-specific stats (both v4 and v6). type IPStats struct { // PacketsReceived is the total number of IP packets received from the link |