copy receiver stats in Stats.Sub()

master
Martin Kobetic 2014-06-24 14:43:21 +00:00
parent c45c4a1ae6
commit bbee09da30
1 changed files with 2 additions and 1 deletions

3
db.go
View File

@ -575,7 +575,8 @@ type Stats struct {
// This is useful when obtaining stats at two different points and time and // This is useful when obtaining stats at two different points and time and
// you need the performance counters that occurred within that time span. // you need the performance counters that occurred within that time span.
func (s *Stats) Sub(other *Stats) Stats { func (s *Stats) Sub(other *Stats) Stats {
var diff Stats var diff Stats = *s
diff.TxN = other.TxN - s.TxN
diff.TxStats = s.TxStats.Sub(&other.TxStats) diff.TxStats = s.TxStats.Sub(&other.TxStats)
return diff return diff
} }