Esempio n. 1
0
    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 "")
Esempio n. 2
0
    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]
Esempio n. 4
0
 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]
    def qos(self):
        """
        Determine a "quality of service" value that can be used for comparisons between runs. This value
        is based on the percentage deviation of means of each request from a set of "benchmarks" for each
        type of request.
        """

        # Get means for each type of method
        means = {}
        for method, results in self._perMethodTimes.items():
            means[method] = mean([duration for success, duration in results if success])

        # Determine percentage differences with weighting
        differences = []
        for method, value in means.items():
            result = self.qos_value(method, value)
            if result is not None:
                differences.append(result)

        return ("%-8.4f" % mean(differences)) if differences else "None"
Esempio n. 6
0
    def qos(self):
        """
        Determine a "quality of service" value that can be used for comparisons between runs. This value
        is based on the percentage deviation of means of each request from a set of "benchmarks" for each
        type of request.
        """

        # Get means for each type of method
        means = {}
        for method, results in self._perMethodTimes.items():
            means[method] = mean(
                [duration for success, duration in results if success])

        # Determine percentage differences with weighting
        differences = []
        for method, value in means.items():
            result = self.qos_value(method, value)
            if result is not None:
                differences.append(result)

        return ("%-8.4f" % mean(differences)) if differences else "None"
Esempio n. 7
0
 def _summarizeData(self, operation, data):
     avglag = mean(self._perOperationLags.get(operation, [0.0])) * 1000.0
     data = SummarizingMixin._summarizeData(self, operation, data)
     return data[:-1] + (avglag,) + data[-1:]
Esempio n. 8
0
 def _summarizeData(self, operation, data):
     avglag = mean(self._perOperationLags.get(operation, [0.0])) * 1000.0
     data = SummarizingMixin._summarizeData(self, operation, data)
     return data[:-1] + (avglag, ) + data[-1:]