mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-15 08:41:02 +00:00
This commit adds some trivial stat-tracking which can be observed at localhost:10101/debug/vars. However, writes to a locking data structure aren't cheap, so the stat-tracking is by default not compiled. To build it, add the build tag `roaringstats`, which will cause the `statsHit` function to actually do something. Otherwise, it's an empty and inlineable function, meaning the compiler throws it away entirely. This would, in principle, let us get additional visibility into edge cases and which code paths are hot. This is not the same thing as profiling for overall performance; the stat counts aren't affected by whether a particular code path is using a large amount of CPU time, just reporting how often it happens at all.
15 lines
289 B
Go
15 lines
289 B
Go
// +build roaringstats
|
|
|
|
package roaring
|
|
|
|
import (
|
|
"github.com/pilosa/pilosa/stats"
|
|
)
|
|
|
|
var statsEv = stats.NewExpvarStatsClient()
|
|
|
|
// statsHit increments the given stat, so we can tell how often we've hit
|
|
// that particular event.
|
|
func statsHit(name string) {
|
|
statsEv.Count(name, 1, 1)
|
|
}
|