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