exec_and_record_function_calls
exec_and_record_function_calls(code, globals_)
¶
Execute the code while recording all the function calls which originate from the code object.
While recording function calls, we use sys.settrace() with LineaPy's tracer to extract relevant information during the runtime of the user's code's function, and reset the tracer after the user function has completed execution to prevent unnecessary logging. However, to ensure LineaPy works correctly while debugging using VSCode, we first capture any existing tracers using sys.gettrace(), perform our analysis using the LineaPy tracer, and reset the existing tracer using sys.settrace()
Source code in lineapy/system_tracing/exec_and_record_function_calls.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|