MCPcopy
hub / github.com/CodisLabs/codis / init

Function init

pkg/proxy/stats.go:63–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61}
62
63func init() {
64 cmdstats.opmap = make(map[string]*opStats, 128)
65 go func() {
66 for {
67 start := time.Now()
68 total := cmdstats.total.Int64()
69 time.Sleep(time.Second)
70 delta := cmdstats.total.Int64() - total
71 normalized := math.Max(0, float64(delta)) * float64(time.Second) / float64(time.Since(start))
72 cmdstats.qps.Set(int64(normalized + 0.5))
73 }
74 }()
75}
76
77func OpTotal() int64 {
78 return cmdstats.total.Int64()

Callers

nothing calls this directly

Calls 3

SleepMethod · 0.65
Int64Method · 0.45
SetMethod · 0.45

Tested by

no test coverage detected