1package store 2 3import ( 4 "github.com/siddontang/go/sync2" 5) 6 7type Stat struct { 8 GetNum sync2.AtomicInt64 9 GetMissingNum sync2.AtomicInt64 10 GetTotalTime sync2.AtomicDuration 11 PutNum sync2.AtomicInt64 12 DeleteNum sync2.AtomicInt64 13 IterNum sync2.AtomicInt64 14 IterSeekNum sync2.AtomicInt64 15 IterCloseNum sync2.AtomicInt64 16 SnapshotNum sync2.AtomicInt64 17 SnapshotCloseNum sync2.AtomicInt64 18 BatchNum sync2.AtomicInt64 19 BatchCommitNum sync2.AtomicInt64 20 BatchCommitTotalTime sync2.AtomicDuration 21 TxNum sync2.AtomicInt64 22 TxCommitNum sync2.AtomicInt64 23 TxCloseNum sync2.AtomicInt64 24 CompactNum sync2.AtomicInt64 25 CompactTotalTime sync2.AtomicDuration 26} 27 28func (st *Stat) statGet(v interface{}, err error) { 29 st.GetNum.Add(1) 30 if v == nil && err == nil { 31 st.GetMissingNum.Add(1) 32 } 33} 34 35func (st *Stat) Reset() { 36 *st = Stat{} 37} 38