mirror of https://github.com/hak5/bolt.git
commit
283c556aa8
14
db.go
14
db.go
|
@ -575,19 +575,11 @@ 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
|
|
||||||
if s == nil {
|
|
||||||
if other == nil {
|
if other == nil {
|
||||||
return diff
|
return *s
|
||||||
} else {
|
|
||||||
return *other
|
|
||||||
}
|
}
|
||||||
}
|
var diff Stat
|
||||||
diff = *s
|
diff.TxN = other.TxN - s.TxN
|
||||||
if other == nil {
|
|
||||||
return diff
|
|
||||||
}
|
|
||||||
diff.TxN = other.TxN - diff.TxN
|
|
||||||
diff.TxStats = s.TxStats.Sub(&other.TxStats)
|
diff.TxStats = s.TxStats.Sub(&other.TxStats)
|
||||||
return diff
|
return diff
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue