2012-07-06 04:44:02 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
"""
|
|
|
|
Script to Summarize statistics in the scan-build output.
|
|
|
|
|
2015-09-08 11:50:52 +08:00
|
|
|
Statistics are enabled by passing '-internal-stats' option to scan-build
|
2012-07-06 04:44:02 +08:00
|
|
|
(or '-analyzer-stats' to the analyzer).
|
|
|
|
"""
|
|
|
|
import sys
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if len(sys.argv) < 2:
|
2020-05-14 18:31:01 +08:00
|
|
|
print('Usage: ', sys.argv[0],
|
|
|
|
'scan_build_output_file', file=sys.stderr)
|
2012-07-06 04:44:02 +08:00
|
|
|
sys.exit(-1)
|
|
|
|
|
|
|
|
f = open(sys.argv[1], 'r')
|
2020-05-22 17:51:25 +08:00
|
|
|
time = 0.0
|
|
|
|
total_time = 0.0
|
|
|
|
max_time = 0.0
|
|
|
|
warnings = 0
|
|
|
|
count = 0
|
|
|
|
functions_analyzed = 0
|
|
|
|
reachable_blocks = 0
|
|
|
|
reached_max_steps = 0
|
|
|
|
num_steps = 0
|
|
|
|
num_inlined_call_sites = 0
|
|
|
|
num_bifurcated_call_sites = 0
|
|
|
|
max_cfg_size = 0
|
|
|
|
|
2012-07-06 04:44:02 +08:00
|
|
|
for line in f:
|
2020-05-22 17:51:25 +08:00
|
|
|
if "Analyzer total time" in line:
|
2017-10-03 01:59:12 +08:00
|
|
|
s = line.split()
|
2020-05-22 17:51:25 +08:00
|
|
|
time = time + float(s[6])
|
|
|
|
count = count + 1
|
|
|
|
if float(s[6]) > max_time:
|
|
|
|
max_time = float(s[6])
|
|
|
|
if "warning generated." in line or "warnings generated" in line:
|
2017-10-03 01:59:12 +08:00
|
|
|
s = line.split()
|
2020-05-22 17:51:25 +08:00
|
|
|
warnings = warnings + int(s[0])
|
2017-10-03 01:59:12 +08:00
|
|
|
if "The # of functions analysed (as top level)" in line:
|
|
|
|
s = line.split()
|
2020-05-22 17:51:25 +08:00
|
|
|
functions_analyzed = functions_analyzed + int(s[0])
|
2017-10-03 01:59:12 +08:00
|
|
|
if "The % of reachable basic blocks" in line:
|
|
|
|
s = line.split()
|
2020-05-22 17:51:25 +08:00
|
|
|
reachable_blocks = reachable_blocks + int(s[0])
|
2017-10-03 01:59:12 +08:00
|
|
|
if "The # of times we reached the max number of steps" in line:
|
|
|
|
s = line.split()
|
2020-05-22 17:51:25 +08:00
|
|
|
reached_max_steps = reached_max_steps + int(s[0])
|
2017-10-03 01:59:12 +08:00
|
|
|
if "The maximum number of basic blocks in a function" in line:
|
|
|
|
s = line.split()
|
2020-05-22 17:51:25 +08:00
|
|
|
if max_cfg_size < int(s[0]):
|
|
|
|
max_cfg_size = int(s[0])
|
2017-10-03 01:59:12 +08:00
|
|
|
if "The # of steps executed" in line:
|
|
|
|
s = line.split()
|
2020-05-22 17:51:25 +08:00
|
|
|
num_steps = num_steps + int(s[0])
|
2017-10-03 01:59:12 +08:00
|
|
|
if "The # of times we inlined a call" in line:
|
|
|
|
s = line.split()
|
2020-05-22 17:51:25 +08:00
|
|
|
num_inlined_call_sites = num_inlined_call_sites + int(s[0])
|
2017-10-03 01:59:12 +08:00
|
|
|
if "The # of times we split the path due \
|
|
|
|
to imprecise dynamic dispatch info" in line:
|
|
|
|
s = line.split()
|
2020-05-22 17:51:25 +08:00
|
|
|
num_bifurcated_call_sites = num_bifurcated_call_sites + int(s[0])
|
2017-10-03 01:59:12 +08:00
|
|
|
if ") Total" in line:
|
|
|
|
s = line.split()
|
2020-05-22 17:51:25 +08:00
|
|
|
total_time = total_time + float(s[6])
|
2015-09-08 11:50:52 +08:00
|
|
|
|
2020-05-22 17:51:25 +08:00
|
|
|
print(f"TU count {count}")
|
|
|
|
print(f"Time {time}")
|
|
|
|
print(f"Warnings {warnings}")
|
|
|
|
print(f"Functions analyzed {functions_analyzed}")
|
|
|
|
print(f"Reachable blocks {reachable_blocks}")
|
|
|
|
print(f"Reached max steps {reached_max_steps}")
|
|
|
|
print(f"Number of steps {num_steps}")
|
|
|
|
print(f"Number of inlined calls {num_inlined_call_sites} "
|
|
|
|
f"(bifurcated {num_bifurcated_call_sites})")
|
|
|
|
print(f"Max time {max_time}")
|
|
|
|
print(f"Total time {total_time}")
|
|
|
|
print(f"Max CFG Size {max_cfg_size}")
|