gcc/contrib/analyze_brprob_spec.py
Jonathan Wakely 29abd09a74 contrib: Remove C-style comments from Python files
These Python scripts have "*/" at the end of the license header comment
blocks, presumably copy&pasted from C files.

contrib/ChangeLog:

	* analyze_brprob.py: Remove stray text at end of comment.
	* analyze_brprob_spec.py: Likewise.
	* check-params-in-docs.py: Likewise.
	* check_GNU_style.py: Likewise.
	* check_GNU_style_lib.py: Likewise.
	* filter-clang-warnings.py: Likewise.
	* gcc-changelog/git_check_commit.py: Likewise.
	* gcc-changelog/git_commit.py: Likewise.
	* gcc-changelog/git_email.py: Likewise.
	* gcc-changelog/git_repository.py: Likewise.
	* gcc-changelog/git_update_version.py: Likewise.
	* gcc-changelog/test_email.py: Likewise.
	* gen_autofdo_event.py: Likewise.
	* mark_spam.py: Likewise.
	* unicode/gen-box-drawing-chars.py: Likewise.
	* unicode/gen-combining-chars.py: Likewise.
	* unicode/gen-printable-chars.py: Likewise.
	* unicode/gen_wcwidth.py: Likewise.
2024-01-05 13:57:05 +00:00

72 lines
2.2 KiB
Python
Executable File

#!/usr/bin/env python3
# Copyright (C) 2016-2024 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
import sys
import os
import subprocess
import tempfile
import argparse
script_location = os.path.realpath(__file__)
parser = argparse.ArgumentParser()
parser.add_argument('location', metavar = 'dump_file',
help = 'Sub-folder with SPEC benchmarks (e.g. Programming/cpu2017/benchspec/CPU)')
parser.add_argument('-s', '--sorting', dest = 'sorting',
choices = ['branches', 'branch-hitrate', 'hitrate', 'coverage', 'name'],
default = 'branches')
parser.add_argument('-d', '--def-file', help = 'path to predict.def')
parser.add_argument('-v', '--verbose', action = 'store_true', help = 'Print verbose informations')
args = parser.parse_args()
benchmarks = os.listdir(args.location)
for b in sorted(benchmarks):
dumps = []
for root, dirs, files in os.walk(os.path.join(args.location, b)):
for x in files:
if x.endswith('.profile'):
dumps.append(os.path.join(root, x))
if len(dumps) == 0:
continue
temp = tempfile.NamedTemporaryFile(delete = False)
for d in dumps:
temp.write(open(d, 'rb').read())
temp.close()
print()
print(f' {b} '.center(160, '='))
sys.stdout.flush()
p = [os.path.join(os.path.dirname(script_location), 'analyze_brprob.py'),
temp.name, '--sorting', args.sorting]
if args.def_file:
p += ['-d', args.def_file]
if args.verbose:
p.append('-v')
p = subprocess.check_call(p)
sys.stdout.flush()
os.remove(temp.name)