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

Function TestTxStats_GetAndIncAtomically

tx_test.go:912–968  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

910}
911
912func TestTxStats_GetAndIncAtomically(t *testing.T) {
913 var stats bolt.TxStats
914
915 stats.IncPageCount(1)
916 assert.Equal(t, int64(1), stats.GetPageCount())
917
918 stats.IncPageAlloc(2)
919 assert.Equal(t, int64(2), stats.GetPageAlloc())
920
921 stats.IncCursorCount(3)
922 assert.Equal(t, int64(3), stats.GetCursorCount())
923
924 stats.IncNodeCount(100)
925 assert.Equal(t, int64(100), stats.GetNodeCount())
926
927 stats.IncNodeDeref(101)
928 assert.Equal(t, int64(101), stats.GetNodeDeref())
929
930 stats.IncRebalance(1000)
931 assert.Equal(t, int64(1000), stats.GetRebalance())
932
933 stats.IncRebalanceTime(1001 * time.Second)
934 assert.Equal(t, 1001*time.Second, stats.GetRebalanceTime())
935
936 stats.IncSplit(10000)
937 assert.Equal(t, int64(10000), stats.GetSplit())
938
939 stats.IncSpill(10001)
940 assert.Equal(t, int64(10001), stats.GetSpill())
941
942 stats.IncSpillTime(10001 * time.Second)
943 assert.Equal(t, 10001*time.Second, stats.GetSpillTime())
944
945 stats.IncWrite(100000)
946 assert.Equal(t, int64(100000), stats.GetWrite())
947
948 stats.IncWriteTime(100001 * time.Second)
949 assert.Equal(t, 100001*time.Second, stats.GetWriteTime())
950
951 assert.Equal(t,
952 bolt.TxStats{
953 PageCount: 1,
954 PageAlloc: 2,
955 CursorCount: 3,
956 NodeCount: 100,
957 NodeDeref: 101,
958 Rebalance: 1000,
959 RebalanceTime: 1001 * time.Second,
960 Split: 10000,
961 Spill: 10001,
962 SpillTime: 10001 * time.Second,
963 Write: 100000,
964 WriteTime: 100001 * time.Second,
965 },
966 stats,
967 )
968}
969

Callers

nothing calls this directly

Calls 15

IncPageCountMethod · 0.95
GetPageCountMethod · 0.95
IncPageAllocMethod · 0.95
GetPageAllocMethod · 0.95
IncCursorCountMethod · 0.95
GetCursorCountMethod · 0.95
IncNodeCountMethod · 0.95
GetNodeCountMethod · 0.95
IncNodeDerefMethod · 0.95
GetNodeDerefMethod · 0.95
IncRebalanceMethod · 0.95
GetRebalanceMethod · 0.95

Tested by

no test coverage detected