class_docstr: A flexible Timer class.
  
  :Example:
  
  >>> import time
  >>> import annotator.uniformer.mmcv as mmcv
  >>> with mmcv.Timer():
  >>>     # simulate a code block that will run for 1s
  >>>     time.sleep(1)
  1.000
  >>> with mmcv.Timer(print_tmpl='it takes {:.1f} seconds'):
  >>>     # simulate a code block that will run for 1s
  >>>     time.sleep(1)
  it takes 1.0 seconds
  >>> timer = mmcv.Timer()
  >>> time.sleep(0.5)
  >>> print(timer.since_start())
  0.500
  >>> time.sleep(0.5)
  >>> print(timer.since_last_check())
  0.500
  >>> print(timer.since_start())
  1.000
class_docstr_tok: ["A","flexible","Timer","class",".",":","Example",":",">",">",">","import","time",">",">",">","import","annotator.uniformer.mmcv","as","mmcv",">",">",">","with","mmcv.Timer","(",")",":",">",">",">","#","simulate","a","code","block","that","will","run","for","1s",">",">",">","time.sleep","(","1",")","1.000",">",">",">","with","mmcv.Timer","(","print_tmpl='it","takes","{",":",".1f","}","seconds","'",")",":",">",">",">","#","simulate","a","code","block","that","will","run","for","1s",">",">",">","time.sleep","(","1",")","it","takes","1.0","seconds",">",">",">","timer","=","mmcv.Timer","(",")",">",">",">","time.sleep","(","0.5",")",">",">",">","print","(","timer.since_start","(",")",")","0.500",">",">",">","time.sleep","(","0.5",")",">",">",">","print","(","timer.since_last_check","(",")",")","0.500",">",">",">","print","(","timer.since_start","(",")",")","1.000"]
code: def __init__(self, start=True, print_tmpl=None):
      self._is_running = False
      self.print_tmpl = print_tmpl if print_tmpl else "{:.3f}"
      if start:
          self.start()
  
file_path: lavis/lavis/common/annotator/uniformer/mmcv/utils/timer.py
imports: from time import time
label_desc: Use image node_id 1 to create a new Timer object  with example: obj = Timer(start, print_tmpl)