mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-10 08:04:58 +08:00
[Misc] small fixes to function tracing file path (#9543)
Signed-off-by: Shawn Du <shawnd200@outlook.com> Signed-off-by: youkaichao <youkaichao@gmail.com> Co-authored-by: youkaichao <youkaichao@gmail.com>
This commit is contained in:
parent
bfb7d61a7c
commit
20cf2f553c
@ -161,11 +161,11 @@ Documentation
|
||||
design/multimodal/multimodal_index
|
||||
design/huggingface_integration
|
||||
|
||||
.. Contributing: contributing to the vLLM project
|
||||
.. For Developers: contributing to the vLLM project
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contributing
|
||||
:caption: For Developers
|
||||
|
||||
contributing/overview
|
||||
contributing/profiling/profiling_index
|
||||
|
||||
@ -117,13 +117,14 @@ def _trace_calls(log_path, root_dir, frame, event, arg=None):
|
||||
last_lineno = 0
|
||||
last_func_name = ""
|
||||
with open(log_path, 'a') as f:
|
||||
ts = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
if event == 'call':
|
||||
f.write(f"{datetime.datetime.now()} Call to"
|
||||
f.write(f"{ts} Call to"
|
||||
f" {func_name} in {filename}:{lineno}"
|
||||
f" from {last_func_name} in {last_filename}:"
|
||||
f"{last_lineno}\n")
|
||||
else:
|
||||
f.write(f"{datetime.datetime.now()} Return from"
|
||||
f.write(f"{ts} Return from"
|
||||
f" {func_name} in {filename}:{lineno}"
|
||||
f" to {last_func_name} in {last_filename}:"
|
||||
f"{last_lineno}\n")
|
||||
|
||||
@ -4,6 +4,7 @@ import contextlib
|
||||
import datetime
|
||||
import enum
|
||||
import gc
|
||||
import getpass
|
||||
import inspect
|
||||
import ipaddress
|
||||
import os
|
||||
@ -967,6 +968,8 @@ def enable_trace_function_call_for_thread() -> None:
|
||||
|
||||
if envs.VLLM_TRACE_FUNCTION:
|
||||
tmp_dir = tempfile.gettempdir()
|
||||
# add username to tmp_dir to avoid permission issues
|
||||
tmp_dir = os.path.join(tmp_dir, getpass.getuser())
|
||||
filename = (f"VLLM_TRACE_FUNCTION_for_process_{os.getpid()}"
|
||||
f"_thread_{threading.get_ident()}_"
|
||||
f"at_{datetime.datetime.now()}.log").replace(" ", "_")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user