def testHistogramStatsCalculator(self):
   histogram = {1: 5, 2: 10, 5: 5}
   stats = netperf_benchmark._HistogramStatsCalculator(
       histogram, [0, 20, 30, 74, 80, 100])
   self.assertEqual(stats['p0'], 1)
   self.assertEqual(stats['p20'], 1)
   self.assertEqual(stats['p30'], 2)
   self.assertEqual(stats['p74'], 2)
   self.assertEqual(stats['p80'], 5)
   self.assertEqual(stats['p100'], 5)
   self.assertLessEqual(abs(stats['stddev'] - 1.538), 0.001)
Esempio n. 2
0
 def testHistogramStatsCalculator(self):
     histogram = {1: 5, 2: 10, 5: 5}
     stats = netperf_benchmark._HistogramStatsCalculator(
         histogram, [0, 20, 30, 74, 80, 100])
     self.assertEqual(stats['p0'], 1)
     self.assertEqual(stats['p20'], 1)
     self.assertEqual(stats['p30'], 2)
     self.assertEqual(stats['p74'], 2)
     self.assertEqual(stats['p80'], 5)
     self.assertEqual(stats['p100'], 5)
     self.assertLessEqual(abs(stats['stddev'] - 1.538), 0.001)