本文整理汇总了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