I want to get the execution trace of a python function in terms of the loops and conditionals executed upon completion. However, I want to do this without instrumenting the original python function with additional parameters. For example:
def foo(int a, int b):
while(c):
do_something()
if(d):
do_something()
if __name__ == "__main__":
foo(a, b)
After the execution of foo() I want a execution trace something like: [while: true, if:false, while: true, if: true, while: false, ...] which documents the sequence of conditional evaluations in the code. Is there any way to get this information automatically for an arbitrary python function?
I understand "Coverage" python module returns the "Branch coverage" information. But I am unsure how to use it in this context?
from Python Code: Information on Execution Trace of loops/conditionals
No comments:
Post a Comment