+func (NameStat) isStat() {}
+func (EmptyStat) isStat() {}
+
+func (s ScalarStat) IsZero() bool {
+ return s == 0
+}
+func (s ErrorStat) IsZero() bool {
+ if s == nil {
+ return true
+ }
+ for _, ss := range s {
+ if ss != 0 {
+ return false
+ }
+ }
+ return true
+}
+func (s SimpleCounterStat) IsZero() bool {
+ if s == nil {
+ return true
+ }
+ for _, ss := range s {
+ for _, sss := range ss {
+ if sss != 0 {
+ return false
+ }
+ }
+ }
+ return true
+}
+func (s CombinedCounterStat) IsZero() bool {
+ if s == nil {
+ return true
+ }
+ for _, ss := range s {
+ if ss == nil {
+ return true
+ }
+ for _, sss := range ss {
+ if sss[0] != 0 || sss[1] != 0 {
+ return false
+ }
+ }
+ }
+ return true
+}
+func (s NameStat) IsZero() bool {
+ if s == nil {
+ return true
+ }
+ for _, ss := range s {
+ if len(ss) > 0 {
+ return false
+ }
+ }
+ return true
+}
+func (s EmptyStat) IsZero() bool {
+ return true
+}
+
+// ReduceSimpleCounterStatIndex returns reduced SimpleCounterStat s for index i.
+func ReduceSimpleCounterStatIndex(s SimpleCounterStat, i int) uint64 {
+ var val uint64
+ for _, w := range s {
+ val += uint64(w[i])
+ }
+ return val
+}
+
+// ReduceCombinedCounterStatIndex returns reduced CombinedCounterStat s for index i.
+func ReduceCombinedCounterStatIndex(s CombinedCounterStat, i int) [2]uint64 {
+ var val [2]uint64
+ for _, w := range s {
+ val[0] += uint64(w[i][0])
+ val[1] += uint64(w[i][1])
+ }
+ return val
+}