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

Method takeM

fbclock/daemon/state.go:125–138  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

123func (s *daemonState) pushM(data float64) {
124 s.Lock()
125 defer s.Unlock()
126 s.mmms.Value = data
127 s.mmms = s.mmms.Next()
128}
129
130func (s *daemonState) takeM(n int) []float64 {
131 s.Lock()
132 defer s.Unlock()
133 result := []float64{}
134 r := s.mmms.Prev()
135 for range n {
136 if r.Value == nil {
137 continue
138 }
139 result = append(result, r.Value.(float64))
140 r = r.Prev()
141 }

Callers 5

calcWMethod · 0.80
TestPushAndTakeMFunction · 0.80
TestTakeMPartialFunction · 0.80
TestTakeMOverflowFunction · 0.80
TestTakeMEmptyFunction · 0.80

Calls 1

UnlockMethod · 0.65

Tested by 4

TestPushAndTakeMFunction · 0.64
TestTakeMPartialFunction · 0.64
TestTakeMOverflowFunction · 0.64
TestTakeMEmptyFunction · 0.64