PrintStats prints the database stats
()
| 203 | |
| 204 | // PrintStats prints the database stats |
| 205 | func (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 | |
| 219 | func truncDuration(d time.Duration) string { |
| 220 | return regexp.MustCompile(`^(\d+)(\.\d+)`).ReplaceAllString(d.String(), "$1") |
no test coverage detected