MCPcopy Create free account
hub / github.com/aws/aws-cli / record_consumption_rate

Method record_consumption_rate

awscli/s3transfer/bandwidth.py:405–421  ·  view source on GitHub ↗

Record the consumption rate based off amount and time point :type amt: int :param amt: The amount that got consumed :type time_at_consumption: float :param time_at_consumption: The time at which the amount was consumed

(self, amt, time_at_consumption)

Source from the content-addressed store, hash-verified

403 )
404
405 def record_consumption_rate(self, amt, time_at_consumption):
406 """Record the consumption rate based off amount and time point
407
408 :type amt: int
409 :param amt: The amount that got consumed
410
411 :type time_at_consumption: float
412 :param time_at_consumption: The time at which the amount was consumed
413 """
414 if self._last_time is None:
415 self._last_time = time_at_consumption
416 self._current_rate = 0.0
417 return
418 self._current_rate = self._calculate_exponential_moving_average_rate(
419 amt, time_at_consumption
420 )
421 self._last_time = time_at_consumption
422
423 def _calculate_rate(self, amt, time_at_consumption):
424 time_delta = time_at_consumption - self._last_time