Unverified Commit 20cf2f55 authored by Shawn Du's avatar Shawn Du Committed by GitHub
Browse files

[Misc] small fixes to function tracing file path (#9543)


Signed-off-by: default avatarShawn Du <shawnd200@outlook.com>
Signed-off-by: default avataryoukaichao <youkaichao@gmail.com>
Co-authored-by: default avataryoukaichao <youkaichao@gmail.com>
parent bfb7d61a
......@@ -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(" ", "_")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment