本文整理匯總了Python中stopwatch.Stopwatch.reset方法的典型用法代碼示例。如果您正苦於以下問題:Python Stopwatch.reset方法的具體用法?Python Stopwatch.reset怎麽用?Python Stopwatch.reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類stopwatch.Stopwatch
的用法示例。
在下文中一共展示了Stopwatch.reset方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_largescale
# 需要導入模塊: from stopwatch import Stopwatch [as 別名]
# 或者: from stopwatch.Stopwatch import reset [as 別名]
def test_largescale():
s = Stopwatch()
integration_factor = 5
device_map = device_parser.build_device_map(device_parser.parse_data('test.xml'))
test_size = 10000
histogram = OrderedDict()
for i in range(5):
time = 0.0
for j in range(5):
s.start()
generate_test_input(device_map, test_size, file_name='test_input1.csv')
s.stop()
print('Generating test input of size {}: '.format(test_size), s.read())
s.reset()
s.start()
analyze_data_nograph('csvs/test_input1.csv', integration_factor, device_map)
s.stop()
print('Processing input of size {}: '.format(test_size), s.read())
time += s.read()
s.reset()
print('Average time for input of size {}: '.format(test_size), time/5)
histogram[test_size] = time/5
test_size *= 2
print(histogram)
for i,j in histogram.items():
print(' size | time ')
print('{0:5d}|{1:5f}'.format(i,j))
示例2: evaluate
# 需要導入模塊: from stopwatch import Stopwatch [as 別名]
# 或者: from stopwatch.Stopwatch import reset [as 別名]
def evaluate(self,times=None):
results = []
s = Stopwatch()
times = times if times != None else self._times
for i in range(times):
self._setup()
s.reset()
gc.disable()
s.start()
self._code()
gc.enable()
results.append(s.read())
self._evaluate_results = [(min(results),sum(results)/times,max(results))] + [results]
return self._evaluate_results