當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。