def _summarizeData(self, operation, data): failed = 0 thresholds = [0] * len(self._thresholds) durations = [] for (success, duration) in data: if not success: failed += 1 for ctr, item in enumerate(self._thresholds): threshold, _ignore_fail_at = item if duration > threshold: thresholds[ctr] += 1 durations.append(duration) # Determine PASS/FAIL failure = False count = len(data) if failed * 100.0 / count > self._fail_cut_off: failure = True for ctr, item in enumerate(self._thresholds): _ignore_threshold, fail_at = item fail_at = fail_at.get(operation, fail_at["default"]) if thresholds[ctr] * 100.0 / count > fail_at: failure = True return (operation, count, failed,) + \ tuple(thresholds) + \ (mean(durations), median(durations), stddev(durations), "FAIL" if failure else "")
def _summarizeData(self, operation, data, total_count): failed = 0 thresholds = [0] * len(self._thresholds) durations = [] for (success, duration) in data: if not success: failed += 1 for ctr, item in enumerate(self._thresholds): threshold, _ignore_fail_at = item if duration > threshold: thresholds[ctr] += 1 durations.append(duration) # Determine PASS/FAIL failure = False count = len(data) if failed * 100.0 / count > self._fail_cut_off: failure = True for ctr, item in enumerate(self._thresholds): _ignore_threshold, fail_at = item fail_at = fail_at.get(operation, fail_at["default"]) if thresholds[ctr] * 100.0 / count > fail_at: failure = True return (operation, count, ((100.0 * count) / total_count) if total_count else 0.0, failed,) + \ tuple(thresholds) + \ (mean(durations), median(durations), stddev(durations), "FAIL" if failure else "")
def eventReceived(self, event): self._times.append(event['duration']) if len(self._times) == 200: print('mean:', mean(self._times)) print('median:', median(self._times)) print('stddev:', stddev(self._times)) print('mad:', mad(self._times)) del self._times[:100]