* g++.dg/debug/dwarf2/ref-3.C: XFAIL AIX.
[official-gcc.git] / contrib / analyze_brprob_spec.py
bloba28eaac39d514e1b6884cdf9571277bfdad8e20f
1 #!/usr/bin/env python3
3 # This file is part of GCC.
5 # GCC is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published by the Free
7 # Software Foundation; either version 3, or (at your option) any later
8 # version.
10 # GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with GCC; see the file COPYING3. If not see
17 # <http://www.gnu.org/licenses/>. */
19 import sys
20 import os
21 import subprocess
22 import tempfile
23 import argparse
25 script_location = os.path.realpath(__file__)
27 parser = argparse.ArgumentParser()
28 parser.add_argument('location', metavar = 'dump_file', help = 'Location with SPEC benchmarks')
29 parser.add_argument('-s', '--sorting', dest = 'sorting', choices = ['branches', 'hitrate', 'coverage'], default = 'branches')
31 args = parser.parse_args()
33 benchmarks = os.listdir(args.location)
35 for b in sorted(benchmarks):
36 dumps = []
37 for root, dirs, files in os.walk(os.path.join(args.location, b)):
38 for x in files:
39 if x.endswith('.profile'):
40 dumps.append(os.path.join(root, x))
42 if len(dumps) == 0:
43 continue
45 temp = tempfile.NamedTemporaryFile(delete = False)
46 for d in dumps:
47 temp.write(open(d, 'rb').read())
49 temp.close()
51 print()
52 print(b)
53 sys.stdout.flush()
54 p = [os.path.join(os.path.dirname(script_location), 'analyze_brprob.py'), temp.name, '--sorting', args.sorting]
55 p = subprocess.check_call(p)
56 sys.stdout.flush()
58 os.remove(temp.name)