forked from a-rahimi/python-checkpointing2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalllog.py
48 lines (33 loc) · 811 Bytes
/
calllog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""Illustrate the call tracer.
$ python3 calllog.py
...
[('calllog.py', 'level1'),
('calllog.py', 'level2'),
('calllog.py', 'level3'),
('/Users/alrhim/Runner/examples/calllog_subordinate.py', 'step2_1')]
"""
import pprint
import function_checkpointing.calltrace as calltrace
import calllog_subordinate
def level1():
print(">level 1")
func = "level1"
level2()
print("<level 1")
def level2():
print(">level 2")
func = "level2"
level3()
print("<level 2")
def level3():
func = "level3"
print(">level 3")
calllog_subordinate.step2_1(1)
print("<level 3")
def main():
func = "main"
calltrace.trace_funcalls([__file__, calllog_subordinate.__file__])
level1()
print("end of main")
main()
pprint.pprint(list(calltrace.funcall_log.keys()))