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

Method aggregateDataPointsMax

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

Source from the content-addressed store, hash-verified

92 result = append(result, r.Value.(*DataPoint))
93 r = r.Prev()
94 }
95 return result
96}
97
98func (s *daemonState) aggregateDataPointsMax(n int) *DataPoint {
99 s.Lock()
100 defer s.Unlock()
101 d := &DataPoint{}
102 r := s.DataPoints.Prev()
103 for range n {
104 if r.Value == nil {
105 continue
106 }
107 dp := r.Value.(*DataPoint)
108 if math.Abs(dp.MasterOffsetNS) > d.MasterOffsetNS {
109 d.MasterOffsetNS = math.Abs(dp.MasterOffsetNS)
110 }
111 if math.Abs(dp.PathDelayNS) > d.PathDelayNS {
112 d.PathDelayNS = math.Abs(dp.PathDelayNS)
113 }
114 if math.Abs(dp.FreqAdjustmentPPB) > d.FreqAdjustmentPPB {
115 d.FreqAdjustmentPPB = math.Abs(dp.FreqAdjustmentPPB)
116 }
117 r = r.Prev()
118 }
119 return d

Calls 1

UnlockMethod · 0.65