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