MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / getOrCreatePoolCounter

Function getOrCreatePoolCounter

pkg/metrics/pool_stats.go:50–65  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

48var standardPoolNames = []string{"tokenizer", "parser", "ast"}
49
50func getOrCreatePoolCounter(name string) *poolCounter {
51 poolStatsMu.RLock()
52 c, ok := poolCounters[name]
53 poolStatsMu.RUnlock()
54 if ok {
55 return c
56 }
57 poolStatsMu.Lock()
58 defer poolStatsMu.Unlock()
59 if c, ok = poolCounters[name]; ok {
60 return c
61 }
62 c = &poolCounter{}
63 poolCounters[name] = c
64 return c
65}
66
67// RecordNamedPoolGet records a Get() call for the named pool and returns the new total.
68// Call this immediately after retrieving an object from a sync.Pool.

Callers 3

RecordNamedPoolGetFunction · 0.85
RecordNamedPoolPutFunction · 0.85
GetPoolStatsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected