Example #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]
Example #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]
Example #3
0
 def test_unique_uniform_histogram(self):
     new_histogram = Histogram.get_uniform()
     self.assertIsNot(new_histogram.sample, self.histogram_u.sample)
Example #4
0
 def test_unique_biased_histogram(self):
     new_histogram = Histogram.get_biased()
     self.assertIsNot(new_histogram.sample, self.histogram_b.sample)
Example #5
0
 def setUp(self):
     self.histogram_b = Histogram.get_biased()
     self.histogram_u = Histogram.get_uniform()
Example #6
0
 def setUp(self):
     self.histogram_b = Histogram.get_biased()
     self.histogram_u = Histogram.get_uniform()
Example #7
0
 def test_unique_uniform_histogram(self):
     new_histogram = Histogram.get_uniform()
     self.assertIsNot(new_histogram.sample, self.histogram_u.sample)
Example #8
0
 def test_unique_biased_histogram(self):
     new_histogram = Histogram.get_biased()
     self.assertIsNot(new_histogram.sample, self.histogram_b.sample)
Example #9
0
 def __init__(self):
     """
     Creates a new L{Timer} instance.
     """
     self.histogram = Histogram.get_biased()
     self.meter = Meter("calls")