Changeset 11
- Timestamp:
- 10/02/07 03:40:45 (22 months ago)
- Files:
-
- 1 modified
-
trunk/pycallgraph.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pycallgraph.py
r10 r11 26 26 27 27 # statistical data 28 call_dict = {} 29 call_stack = ['__main__'] 30 func_count = {} 31 func_count_max = 0 28 def reset_trace(): 29 global call_dict 30 call_dict = {} 31 global call_stack 32 call_stack = ['__main__'] 33 global func_count 34 func_count = {} 35 global func_count_max 36 func_count_max = 0 37 38 reset_trace() 32 39 33 40 # graphviz settings … … 43 50 }, 44 51 } 52 53 # settings for building dot files 45 54 settings = { 46 55 'node_attributes': { … … 58 67 'include_func': [], 59 68 'include_specific': [], 69 'dont_exclude_anything': False, 60 70 } 61 71 … … 63 73 pass 64 74 65 def start_trace(): 75 def start_trace(reset=True): 76 if reset: 77 reset_trace() 66 78 sys.settrace(tracer) 67 79 … … 110 122 func_name = code.co_name 111 123 if func_name == '?': 112 func_name = 'nofunc' 113 dont_keep = True 124 func_name = '__main__' 114 125 else: 115 126 if settings['include_func']: … … 128 139 # throw it all in dictonaires 129 140 fr = call_stack[-1] 130 if not dont_keep :141 if not dont_keep or settings['dont_exclude_anything']: 131 142 if fr not in call_dict: 132 143 call_dict[fr] = {}