From b52d562dad08ae8a777003eef4b092abcb05f7c5 Mon Sep 17 00:00:00 2001 From: Joseph Lawson Date: Wed, 23 Apr 2014 12:47:16 -0400 Subject: [PATCH] tweaking stat output --- gor_stat.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gor_stat.go b/gor_stat.go index 5990b98..21b4f5c 100644 --- a/gor_stat.go +++ b/gor_stat.go @@ -44,6 +44,12 @@ func (s *GorStat) Write(latest int) { } } +func (s *GorStat) Reset() { + s.latest = 0 + s.max = 0 + s.mean = 0 +} + func (s *GorStat) String() string { return s.statName + ":" + strconv.Itoa(s.latest) + "," + strconv.Itoa(s.mean) + "," + strconv.Itoa(s.max) } @@ -51,6 +57,7 @@ func (s *GorStat) String() string { func (s *GorStat) reportStats() { for { log.Println(s) + s.Reset() time.Sleep(rate * time.Second) } }