2021-11-30 15:00:37 +08:00
|
|
|
# Copyright (c) OpenMMLab. All rights reserved.
|
2021-09-22 19:42:16 +08:00
|
|
|
import time
|
|
|
|
|
|
|
|
from mmdeploy.utils.timer import TimeCounter
|
|
|
|
|
|
|
|
|
|
|
|
def test_count_time():
|
|
|
|
|
|
|
|
class test:
|
|
|
|
|
|
|
|
@TimeCounter.count_time()
|
|
|
|
def fun1(self):
|
|
|
|
time.sleep(0.01)
|
|
|
|
|
|
|
|
t = test()
|
|
|
|
with TimeCounter.activate('fun1', warmup=10, log_interval=10):
|
|
|
|
for i in range(50):
|
|
|
|
t.fun1()
|
|
|
|
|
|
|
|
for i in range(50):
|
|
|
|
t.fun1()
|