mirror of
https://github.com/open-mmlab/mmdeploy.git
synced 2025-01-14 08:09:43 +08:00
* add profile tool * remove print envs in profile tool * set cudnn_benchmark to True * add doc * update tests * fix typo * support test with images from a directory * update doc * resolve comments
24 lines
453 B
Python
24 lines
453 B
Python
# Copyright (c) OpenMMLab. All rights reserved.
|
|
import time
|
|
|
|
from mmdeploy.utils.timer import TimeCounter
|
|
|
|
|
|
def test_count_time():
|
|
|
|
class test:
|
|
|
|
@TimeCounter.count_time('fun1')
|
|
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()
|
|
|
|
TimeCounter.print_stats('fun1')
|