File: SumTimerInfo.py

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (83 lines) | stat: -rw-r--r-- 2,875 bytes parent folder | download | duplicates (9)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python3

"""
Script to Summarize statistics in the scan-build output.

Statistics are enabled by passing '-internal-stats' option to scan-build
(or '-analyzer-stats' to the analyzer).
"""
import sys

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: ", sys.argv[0], "scan_build_output_file", file=sys.stderr)
        sys.exit(-1)

    f = open(sys.argv[1], "r")
    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

    for line in f:
        if "Analyzer total time" in line:
            s = line.split()
            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:
            s = line.split()
            warnings = warnings + int(s[0])
        if "The # of functions analysed (as top level)" in line:
            s = line.split()
            functions_analyzed = functions_analyzed + int(s[0])
        if "The % of reachable basic blocks" in line:
            s = line.split()
            reachable_blocks = reachable_blocks + int(s[0])
        if "The # of times we reached the max number of steps" in line:
            s = line.split()
            reached_max_steps = reached_max_steps + int(s[0])
        if "The maximum number of basic blocks in a function" in line:
            s = line.split()
            if max_cfg_size < int(s[0]):
                max_cfg_size = int(s[0])
        if "The # of steps executed" in line:
            s = line.split()
            num_steps = num_steps + int(s[0])
        if "The # of times we inlined a call" in line:
            s = line.split()
            num_inlined_call_sites = num_inlined_call_sites + int(s[0])
        if (
            "The # of times we split the path due \
                to imprecise dynamic dispatch info"
            in line
        ):
            s = line.split()
            num_bifurcated_call_sites = num_bifurcated_call_sites + int(s[0])
        if ")  Total" in line:
            s = line.split()
            total_time = total_time + float(s[6])

    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}")