mirror of
https://github.com/open-mmlab/mmdeploy.git
synced 2025-01-14 08:09:43 +08:00
* add time counter * add time-count to all backends * fix lint * add docstring and unit tests * use test instead * remove enable member * refinement * replace runtime error with assert and log speed with a single line * fix unit tests * resolve comments and add file output * remove an argument
21 lines
362 B
Python
21 lines
362 B
Python
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()
|