From 7c3994b8966600029aaf273caa7c87593464224d Mon Sep 17 00:00:00 2001 From: Yinzuo Jiang Date: Sun, 9 Nov 2025 20:14:29 +0800 Subject: [PATCH] fix(32-wallclock-profiler): use absolute path to find tool paths Problem: `Path(__file__)` can be ".", in such case `self.oncpu_tool` is "oncputime", which can not be found by the shell. Solution: Translate `Path(__file__)` to absolute path. --- src/32-wallclock-profiler/wallclock_profiler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/32-wallclock-profiler/wallclock_profiler.py b/src/32-wallclock-profiler/wallclock_profiler.py index a7b64c51..dcf843f3 100755 --- a/src/32-wallclock-profiler/wallclock_profiler.py +++ b/src/32-wallclock-profiler/wallclock_profiler.py @@ -32,7 +32,7 @@ def __init__(self, pid, duration=30, freq=49, min_block_us=1000): self.offcpu_error = None # Find tool paths - self.script_dir = Path(__file__).parent + self.script_dir = Path(__file__).absolute().parent self.oncpu_tool = self.script_dir / "oncputime" self.offcpu_tool = self.script_dir / "offcputime" @@ -916,4 +916,4 @@ def main(): sys.exit(1) if __name__ == "__main__": - main() \ No newline at end of file + main()