当前位置: 首页>>代码示例>>Python>>正文


Python StopWatch.wall_sum方法代码示例

本文整理汇总了Python中autosklearn.util.StopWatch.wall_sum方法的典型用法代码示例。如果您正苦于以下问题:Python StopWatch.wall_sum方法的具体用法?Python StopWatch.wall_sum怎么用?Python StopWatch.wall_sum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在autosklearn.util.StopWatch的用法示例。


在下文中一共展示了StopWatch.wall_sum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_stopwatch_overhead

# 需要导入模块: from autosklearn.util import StopWatch [as 别名]
# 或者: from autosklearn.util.StopWatch import wall_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())
开发者ID:Bryan-LL,项目名称:auto-sklearn,代码行数:21,代码来源:test_StopWatch.py

示例2: test_stopwatch_overhead

# 需要导入模块: from autosklearn.util import StopWatch [as 别名]
# 或者: from autosklearn.util.StopWatch import wall_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)
开发者ID:ixtel,项目名称:auto-sklearn,代码行数:26,代码来源:test_StopWatch.py


注:本文中的autosklearn.util.StopWatch.wall_sum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。