code: def viztracer_profile(
      path: Union[Callable[[], str], str],
      depth: int = -1,
      log_async: bool = False,
  ):
      try:
          import viztracer
      except ImportError:
          print(
              "Failed to run profiler, viztracer is not installed"
          )  # noqa: T201
          yield
          return
  
      tracer = viztracer.VizTracer(
          max_stack_depth=depth, log_async=log_async
      )
  
      tracer.start()
      try:
          yield
      finally:
          tracer.stop()
          tracer.save(path() if callable(path) else path)
  
file_path: dvc/dvc/_debug.py
imports: from contextlib import ExitStack, contextmanager
  from datetime import datetime
  from typing import TYPE_CHECKING, Callable, Optional, Union
label_desc: Use image node_id 1 for calling a global function with example usage: viztracer_profile(path, depth, log_async) without return types