コード例 #1
0
ファイル: process.py プロジェクト: sencha/chromium-spacewalk
 def GetOrCreateCounter(self, category, name):
   try:
     return self.GetCounter(category, name)
   except ValueError:
     ctr = tracing_counter.Counter(self, category, name)
     self._counters[ctr.full_name] = ctr
     return ctr
コード例 #2
0
 def testMultiCounterUpdateBounds(self):
   ctr = tracing_counter.Counter(
       None, 'testBasicCounter', 'testBasicCounter')
   ctr.series_names = ['value1', 'value2']
   ctr.timestamps = [0, 1, 2, 3, 4, 5, 6, 7]
   ctr.samples = [0, 0,
                  1, 0,
                  1, 1,
                  2, 1.1,
                  3, 0,
                  1, 7,
                  3, 0,
                  3.1, 0.5]
   ctr.FinalizeImport()
   self.assertEqual(8, ctr.max_total)
   self.assertEqual([0, 0,
                     1, 1,
                     1, 2,
                     2, 3.1,
                     3, 3,
                     1, 8,
                     3, 3,
                     3.1, 3.6], ctr.totals)
コード例 #3
0
ファイル: counter_unittest.py プロジェクト: gam0za/AlbaAlza
 def setUp(self):
   parent = FakeProcess()
   self.counter = counter_module.Counter(parent, 'cat', 'name')