diff options
author | Matt Joiner <anacrolix@gmail.com> | 2019-11-05 18:55:37 +1100 |
---|---|---|
committer | Matt Joiner <anacrolix@gmail.com> | 2019-11-05 18:55:37 +1100 |
commit | 443c0b33d649e0f5e804ce126e371ec47a15805e (patch) | |
tree | 8ba0e298ed06a3ce8ac43334b44305a5d0aa9b6d /funcs.go | |
parent | Add stmutil.List (diff) | |
download | stm-443c0b33d649e0f5e804ce126e371ec47a15805e.tar.gz stm-443c0b33d649e0f5e804ce126e371ec47a15805e.tar.xz |
Add failed commits profiling
Diffstat (limited to 'funcs.go')
-rw-r--r-- | funcs.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1,6 +1,7 @@ package stm import ( + "runtime/pprof" "sync" ) @@ -14,8 +15,17 @@ var ( tx.cond.L = &tx.mu return tx }} + failedCommitsProfile *pprof.Profile ) +const profileFailedCommits = false + +func init() { + if profileFailedCommits { + failedCommitsProfile = pprof.NewProfile("stmFailedCommits") + } +} + // Atomically executes the atomic function fn. func Atomically(fn func(*Tx)) interface{} { expvars.Add("atomically", 1) @@ -52,6 +62,9 @@ retry: if !tx.verify() { tx.unlock() expvars.Add("failed commits", 1) + if profileFailedCommits { + failedCommitsProfile.Add(new(int), 0) + } goto retry } // commit the write log and broadcast that variables have changed |