MCPcopy Create free account
hub / github.com/facebook/time / computeRates

Method computeRates

cmd/ntripper/stats/json.go:62–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60}
61
62func (s *JSONStats) computeRates() {
63 ticker := time.NewTicker(time.Second)
64 defer ticker.Stop()
65 for range ticker.C {
66 cur := s.framesReceived.Load()
67 prev := s.lastFrames.Swap(cur)
68 s.framesPerSecond.Store(cur - prev)
69 }
70}
71
72func (s *JSONStats) handleRequest(w http.ResponseWriter, _ *http.Request) {
73 snap := snapshot{

Callers 2

StartMethod · 0.95

Calls 2

SwapMethod · 0.80
StopMethod · 0.45

Tested by 1