Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/contributing/profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ Both the `vllm.utils.profiling.cprofile` and `vllm.utils.profiling.cprofile_cont
used to profile a section of code.

!!! note
The legacy import paths `vllm.utils.cprofile` and `vllm.utils.cprofile_context` are deprecated.
Please use `vllm.utils.profiling.cprofile` and `vllm.utils.profiling.cprofile_context` instead.
The `vllm.utils.profiling` helpers are deprecated and will be removed in
`v0.21`. Please use Python's `cProfile` module directly instead.

### Example usage - decorator

Expand Down
10 changes: 10 additions & 0 deletions vllm/utils/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
from functools import wraps
from typing import Any

from typing_extensions import deprecated


@deprecated(
"vllm.utils.profiling.cprofile_context() is deprecated and will be removed "
"in v0.21. Use Python's cProfile module directly instead."
)
@contextlib.contextmanager
def cprofile_context(save_file: str | None = None):
"""Run a cprofile
Expand All @@ -32,6 +38,10 @@ def cprofile_context(save_file: str | None = None):
prof.print_stats(sort="cumtime")


@deprecated(
"vllm.utils.profiling.cprofile() is deprecated and will be removed in "
"v0.21. Use Python's cProfile module directly instead."
)
def cprofile(save_file: str | None = None, enabled: bool = True):
"""Decorator to profile a Python method using cProfile.

Expand Down
Loading