4 Script to Summarize statistics in the scan-build output.
6 Statistics are enabled by passing '-internal-stats' option to scan-build
7 (or '-analyzer-stats' to the analyzer).
11 if __name__
== "__main__":
13 print("Usage: ", sys
.argv
[0], "scan_build_output_file", file=sys
.stderr
)
16 f
= open(sys
.argv
[1], "r")
22 functions_analyzed
= 0
26 num_inlined_call_sites
= 0
27 num_bifurcated_call_sites
= 0
31 if "Analyzer total time" in line
:
33 time
= time
+ float(s
[6])
35 if float(s
[6]) > max_time
:
36 max_time
= float(s
[6])
37 if "warning generated." in line
or "warnings generated" in line
:
39 warnings
= warnings
+ int(s
[0])
40 if "The # of functions analysed (as top level)" in line
:
42 functions_analyzed
= functions_analyzed
+ int(s
[0])
43 if "The % of reachable basic blocks" in line
:
45 reachable_blocks
= reachable_blocks
+ int(s
[0])
46 if "The # of times we reached the max number of steps" in line
:
48 reached_max_steps
= reached_max_steps
+ int(s
[0])
49 if "The maximum number of basic blocks in a function" in line
:
51 if max_cfg_size
< int(s
[0]):
52 max_cfg_size
= int(s
[0])
53 if "The # of steps executed" in line
:
55 num_steps
= num_steps
+ int(s
[0])
56 if "The # of times we inlined a call" in line
:
58 num_inlined_call_sites
= num_inlined_call_sites
+ int(s
[0])
60 "The # of times we split the path due \
61 to imprecise dynamic dispatch info"
65 num_bifurcated_call_sites
= num_bifurcated_call_sites
+ int(s
[0])
68 total_time
= total_time
+ float(s
[6])
70 print(f
"TU count {count}")
72 print(f
"Warnings {warnings}")
73 print(f
"Functions analyzed {functions_analyzed}")
74 print(f
"Reachable blocks {reachable_blocks}")
75 print(f
"Reached max steps {reached_max_steps}")
76 print(f
"Number of steps {num_steps}")
78 f
"Number of inlined calls {num_inlined_call_sites} "
79 f
"(bifurcated {num_bifurcated_call_sites})"
81 print(f
"Max time {max_time}")
82 print(f
"Total time {total_time}")
83 print(f
"Max CFG Size {max_cfg_size}")