本文整理匯總了Python中autosklearn.util.StopWatch.cpu_sum方法的典型用法代碼示例。如果您正苦於以下問題:Python StopWatch.cpu_sum方法的具體用法?Python StopWatch.cpu_sum怎麽用?Python StopWatch.cpu_sum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類autosklearn.util.StopWatch
的用法示例。
在下文中一共展示了StopWatch.cpu_sum方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_stopwatch_overhead
# 需要導入模塊: from autosklearn.util import StopWatch [as 別名]
# 或者: from autosklearn.util.StopWatch import cpu_sum [as 別名]
def test_stopwatch_overhead(self):
# Wall Overhead
start = time.time()
cpu_start = time.clock()
watch = StopWatch()
for i in range(1, 1000):
watch.start_task('task_%d' % i)
watch.stop_task('task_%d' % i)
cpu_stop = time.clock()
stop = time.time()
dur = stop - start
cpu_dur = cpu_stop - cpu_start
cpu_overhead = cpu_dur - watch.cpu_sum()
wall_overhead = dur - watch.wall_sum()
self.assertLess(cpu_overhead, 1)
self.assertLess(wall_overhead, 1)
self.assertLess(watch.cpu_sum(), 2 * watch.wall_sum())
示例2: test_stopwatch_overhead
# 需要導入模塊: from autosklearn.util import StopWatch [as 別名]
# 或者: from autosklearn.util.StopWatch import cpu_sum [as 別名]
def test_stopwatch_overhead(self):
# CPU overhead
start = time.clock()
watch = StopWatch()
for i in range(1, 100000):
watch.start_task("task_%d" % i)
watch.stop_task("task_%d" % i)
stop = time.clock()
dur = stop - start
cpu_overhead = dur - watch.cpu_sum()
self.assertLess(cpu_overhead, 1.5)
# Wall Overhead
start = time.time()
watch = StopWatch()
for i in range(1, 100000):
watch.start_task("task_%d" % i)
watch.stop_task("task_%d" % i)
stop = time.time()
dur = stop - start
wall_overhead = dur - watch.wall_sum()
self.assertLess(wall_overhead, 2)
self.assertLess(cpu_overhead, wall_overhead)