aboutsummaryrefslogtreecommitdiff
path: root/bucket.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-04-02 15:36:53 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-04-02 16:03:03 -0600
commit686b6a334173c40ae91d3cdd7d7d759bf8851df6 (patch)
treeba4d50edab37175bd1f1958e458257b50f27fe90 /bucket.go
parentMerge pull request #111 from benbjohnson/flock (diff)
downloaddedo-686b6a334173c40ae91d3cdd7d7d759bf8851df6.tar.gz
dedo-686b6a334173c40ae91d3cdd7d7d759bf8851df6.tar.xz
Add performance counters.
This commit adds performance counters for each transaction which are rolled up to the database level on each commit/rollback. Counters are meant to be a very fast way to track what is going on in the database. A few timers are also added in areas where the time.Now() overhead is not noticible. The DB.Stat() function is now deprecated since the `bolt` CLI now performs similar functions. Fixes #108.
Diffstat (limited to 'bucket.go')
-rw-r--r--bucket.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/bucket.go b/bucket.go
index 57c5441..919d33b 100644
--- a/bucket.go
+++ b/bucket.go
@@ -65,6 +65,10 @@ func (b *Bucket) Writable() bool {
// The cursor is only valid as long as the transaction is open.
// Do not use a cursor after the transaction is closed.
func (b *Bucket) Cursor() *Cursor {
+ // Update transaction statistics.
+ b.tx.stats.CursorCount++
+
+ // Allocate and return a cursor.
return &Cursor{
tx: b.tx,
root: b.root,