@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 301024aa9c
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 4, 21:15 UTC

[Deprecation] Deprecate cprofile and cprofile_context (#39100)

Signed-off-by: yewentao256 <zhyanwentao@126.com>

Wentao Ye committed Apr 20, 2026 at 23:25 UTC 301024aa9c40dd8fe8602263c606adb3749a5fba
2 files changed +12 -2
docs/contributing/profiling.md
+2 -2
@@ -206,8 +206,8 @@ Both the `vllm.utils.profiling.cprofile` and `vllm.utils.profiling.cprofile_cont
206 used to profile a section of code.
207
208 !!! note
209 - The legacy import paths `vllm.utils.cprofile` and `vllm.utils.cprofile_context` are deprecated.
210 - Please use `vllm.utils.profiling.cprofile` and `vllm.utils.profiling.cprofile_context` instead.
209 + The `vllm.utils.profiling` helpers are deprecated and will be removed in
210 + `v0.21`. Please use Python's `cProfile` module directly instead.
211
212 ### Example usage - decorator
213
vllm/utils/profiling.py
+10
@@ -8,7 +8,13 @@ from collections.abc import Callable
8 from functools import wraps
9 from typing import Any
10
11 +from typing_extensions import deprecated
12
13 +
14 +@deprecated(
15 + "vllm.utils.profiling.cprofile_context() is deprecated and will be removed "
16 + "in v0.21. Use Python's cProfile module directly instead."
17 +)
18 @contextlib.contextmanager
19 def cprofile_context(save_file: str | None = None):
20 """Run a cprofile
@@ -32,6 +38,10 @@ def cprofile_context(save_file: str | None = None):
38 prof.print_stats(sort="cumtime")
39
40
41 +@deprecated(
42 + "vllm.utils.profiling.cprofile() is deprecated and will be removed in "
43 + "v0.21. Use Python's cProfile module directly instead."
44 +)
45 def cprofile(save_file: str | None = None, enabled: bool = True):
46 """Decorator to profile a Python method using cProfile.
47