Пример #1
0
    def histogram(self, key, biased=False):
        """
        Gets a histogram based on a key, creates a new one if it does not exist.

        @param key: name of the metric
        @type key: C{str}

        @return: L{Histogram}
        """
        if key not in self._histograms:
            if biased:
                self._histograms[key] = Histogram.get_biased()
            else:
                self._histograms[key] = Histogram.get_uniform()

        return self._histograms[key]
Пример #2
0
    def histogram(self, key, biased=False):
        """
        Gets a histogram based on a key, creates a new one if it does not exist.

        @param key: name of the metric
        @type key: C{str}

        @return: L{Histogram}
        """
        if key not in self._histograms:
            if biased:
                self._histograms[key] = Histogram.get_biased()
            else:
                self._histograms[key] = Histogram.get_uniform()

        return self._histograms[key]
Пример #3
0
 def test_unique_uniform_histogram(self):
     new_histogram = Histogram.get_uniform()
     self.assertIsNot(new_histogram.sample, self.histogram_u.sample)
Пример #4
0
 def test_unique_biased_histogram(self):
     new_histogram = Histogram.get_biased()
     self.assertIsNot(new_histogram.sample, self.histogram_b.sample)
Пример #5
0
 def setUp(self):
     self.histogram_b = Histogram.get_biased()
     self.histogram_u = Histogram.get_uniform()
Пример #6
0
 def setUp(self):
     self.histogram_b = Histogram.get_biased()
     self.histogram_u = Histogram.get_uniform()
Пример #7
0
 def test_unique_uniform_histogram(self):
     new_histogram = Histogram.get_uniform()
     self.assertIsNot(new_histogram.sample, self.histogram_u.sample)
Пример #8
0
 def test_unique_biased_histogram(self):
     new_histogram = Histogram.get_biased()
     self.assertIsNot(new_histogram.sample, self.histogram_b.sample)
Пример #9
0
 def __init__(self):
     """
     Creates a new L{Timer} instance.
     """
     self.histogram = Histogram.get_biased()
     self.meter = Meter("calls")