MCPcopy Create free account
hub / github.com/ARM-software/AVH / updateTimer

Method updateTimer

interface/sensor/python/vsi_sensor.py:150–169  ·  view source on GitHub ↗
(self, interval)

Source from the content-addressed store, hash-verified

148 # Calculate new average timer interval when current record timestamp is at least
149 # SLIDE_INTERVAL ahead of last timestamp used for updating the timer
150 def updateTimer(self, interval):
151 logger.info("Update AVH TimerEvent interval")
152 if len(self.timestamp) > self.cnt:
153 time_delta = self.timestamp[self.cnt] - self.timestamp[self.cnt_old]
154 elif len(self.timestamp) == 0:
155 time_delta = self.SLIDE_INTERVAL
156 else:
157 time_delta = 0
158
159 if time_delta >= self.SLIDE_INTERVAL:
160 self.__getWindow()
161 self.__getInterval()
162 self.cnt_old = self.cnt
163
164 if self.timer_event_cnt == 0:
165 self.initial_interval = interval
166 if self.interval > 0:
167 interval = self.interval
168
169 return interval
170
171 # Track AVH time based on timerEvent() calls and current interval setting
172 def trackTime(self):

Callers 1

wrTimerIntervalFunction · 0.80

Calls 2

__getWindowMethod · 0.95
__getIntervalMethod · 0.95

Tested by

no test coverage detected