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

Method PrintStats

internal/btesting/btesting.go:205–217  ·  view source on GitHub ↗

PrintStats prints the database stats

()

Source from the content-addressed store, hash-verified

203
204// PrintStats prints the database stats
205func (db *DB) PrintStats() {
206 var stats = db.Stats()
207 fmt.Printf("[db] %-20s %-20s %-20s\n",
208 fmt.Sprintf("pg(%d/%d)", stats.TxStats.GetPageCount(), stats.TxStats.GetPageAlloc()),
209 fmt.Sprintf("cur(%d)", stats.TxStats.GetCursorCount()),
210 fmt.Sprintf("node(%d/%d)", stats.TxStats.GetNodeCount(), stats.TxStats.GetNodeDeref()),
211 )
212 fmt.Printf(" %-20s %-20s %-20s\n",
213 fmt.Sprintf("rebal(%d/%v)", stats.TxStats.GetRebalance(), truncDuration(stats.TxStats.GetRebalanceTime())),
214 fmt.Sprintf("spill(%d/%v)", stats.TxStats.GetSpill(), truncDuration(stats.TxStats.GetSpillTime())),
215 fmt.Sprintf("w(%d/%v)", stats.TxStats.GetWrite(), truncDuration(stats.TxStats.GetWriteTime())),
216 )
217}
218
219func truncDuration(d time.Duration) string {
220 return regexp.MustCompile(`^(\d+)(\.\d+)`).ReplaceAllString(d.String(), "$1")

Callers 1

CloseMethod · 0.95

Calls 13

StatsMethod · 0.95
truncDurationFunction · 0.85
GetPageCountMethod · 0.80
GetPageAllocMethod · 0.80
GetCursorCountMethod · 0.80
GetNodeCountMethod · 0.80
GetNodeDerefMethod · 0.80
GetRebalanceMethod · 0.80
GetRebalanceTimeMethod · 0.80
GetSpillMethod · 0.80
GetSpillTimeMethod · 0.80
GetWriteMethod · 0.80

Tested by

no test coverage detected