diff options
Diffstat (limited to 'Godeps/_workspace/src/github.com/obscuren/qml/stats.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/obscuren/qml/stats.go | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/Godeps/_workspace/src/github.com/obscuren/qml/stats.go b/Godeps/_workspace/src/github.com/obscuren/qml/stats.go deleted file mode 100644 index 9f6e94d83..000000000 --- a/Godeps/_workspace/src/github.com/obscuren/qml/stats.go +++ /dev/null @@ -1,68 +0,0 @@ -package qml - -import ( - "sync" -) - -var stats *Statistics -var statsMutex sync.Mutex - -func Stats() (snapshot Statistics) { - statsMutex.Lock() - snapshot = *stats - statsMutex.Unlock() - return -} - -func CollectStats(enabled bool) { - statsMutex.Lock() - if enabled { - if stats == nil { - stats = &Statistics{} - } - } else { - stats = nil - } - statsMutex.Unlock() -} - -func ResetStats() { - statsMutex.Lock() - old := stats - stats = &Statistics{} - // These are absolute values: - stats.EnginesAlive = old.EnginesAlive - stats.ValuesAlive = old.ValuesAlive - statsMutex.Unlock() - return -} - -type Statistics struct { - EnginesAlive int - ValuesAlive int - ConnectionsAlive int -} - -func (stats *Statistics) enginesAlive(delta int) { - if stats != nil { - statsMutex.Lock() - stats.EnginesAlive += delta - statsMutex.Unlock() - } -} - -func (stats *Statistics) valuesAlive(delta int) { - if stats != nil { - statsMutex.Lock() - stats.ValuesAlive += delta - statsMutex.Unlock() - } -} - -func (stats *Statistics) connectionsAlive(delta int) { - if stats != nil { - statsMutex.Lock() - stats.ConnectionsAlive += delta - statsMutex.Unlock() - } -} |