Skip to content

Commit ca92713

Browse files
authored
fix(32-wallclock-profiler): use absolute path to find tool paths (#186)
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.
1 parent 2c9870b commit ca92713

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/32-wallclock-profiler/wallclock_profiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, pid, duration=30, freq=49, min_block_us=1000):
3232
self.offcpu_error = None
3333

3434
# Find tool paths
35-
self.script_dir = Path(__file__).parent
35+
self.script_dir = Path(__file__).absolute().parent
3636
self.oncpu_tool = self.script_dir / "oncputime"
3737
self.offcpu_tool = self.script_dir / "offcputime"
3838

@@ -916,4 +916,4 @@ def main():
916916
sys.exit(1)
917917

918918
if __name__ == "__main__":
919-
main()
919+
main()

0 commit comments

Comments
 (0)