MCPcopy
hub / github.com/etcd-io/bbolt / Sub

Method Sub

tx.go:760–775  ·  view source on GitHub ↗

Sub calculates and returns the difference between two sets of transaction stats. This is useful when obtaining stats at two different points and time and you need the performance counters that occurred within that time span.

(other *TxStats)

Source from the content-addressed store, hash-verified

758// This is useful when obtaining stats at two different points and time and
759// you need the performance counters that occurred within that time span.
760func (s *TxStats) Sub(other *TxStats) TxStats {
761 var diff TxStats
762 diff.PageCount = s.GetPageCount() - other.GetPageCount()
763 diff.PageAlloc = s.GetPageAlloc() - other.GetPageAlloc()
764 diff.CursorCount = s.GetCursorCount() - other.GetCursorCount()
765 diff.NodeCount = s.GetNodeCount() - other.GetNodeCount()
766 diff.NodeDeref = s.GetNodeDeref() - other.GetNodeDeref()
767 diff.Rebalance = s.GetRebalance() - other.GetRebalance()
768 diff.RebalanceTime = s.GetRebalanceTime() - other.GetRebalanceTime()
769 diff.Split = s.GetSplit() - other.GetSplit()
770 diff.Spill = s.GetSpill() - other.GetSpill()
771 diff.SpillTime = s.GetSpillTime() - other.GetSpillTime()
772 diff.Write = s.GetWrite() - other.GetWrite()
773 diff.WriteTime = s.GetWriteTime() - other.GetWriteTime()
774 return diff
775}
776
777// GetPageCount returns PageCount atomically.
778func (s *TxStats) GetPageCount() int64 {

Callers 1

TestTxStats_SubFunction · 0.95

Calls 12

GetPageCountMethod · 0.95
GetPageAllocMethod · 0.95
GetCursorCountMethod · 0.95
GetNodeCountMethod · 0.95
GetNodeDerefMethod · 0.95
GetRebalanceMethod · 0.95
GetRebalanceTimeMethod · 0.95
GetSplitMethod · 0.95
GetSpillMethod · 0.95
GetSpillTimeMethod · 0.95
GetWriteMethod · 0.95
GetWriteTimeMethod · 0.95

Tested by 1

TestTxStats_SubFunction · 0.76