aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-09 11:39:08 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-09 11:39:08 +0000
commit055ac4138d5e7cb56b641afd187e61670ee2a555 (patch)
treed05363003c3241ddf1a33647fc898d5daf0c3b28 /contrib
parent2a364b3894bb9638b70c0fc3d39601f3afb8972f (diff)
Add new analyze_brprob_spec.py script
* analyze_brprob_spec.py: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237257 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ChangeLog4
-rwxr-xr-xcontrib/analyze_brprob_spec.py58
2 files changed, 62 insertions, 0 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 8017e48d9a1..71835a080b9 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,5 +1,9 @@
2016-06-09 Martin Liska <mliska@suse.cz>
+ * analyze_brprob_spec.py: New file.
+
+2016-06-09 Martin Liska <mliska@suse.cz>
+
* analyze_brprob.py: Add new argument --sorting.
2016-06-09 Martin Liska <mliska@suse.cz>
diff --git a/contrib/analyze_brprob_spec.py b/contrib/analyze_brprob_spec.py
new file mode 100755
index 00000000000..a28eaac39d5
--- /dev/null
+++ b/contrib/analyze_brprob_spec.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python3
+
+# 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 = 'Location with SPEC benchmarks')
+parser.add_argument('-s', '--sorting', dest = 'sorting', choices = ['branches', 'hitrate', 'coverage'], default = 'branches')
+
+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(b)
+ sys.stdout.flush()
+ p = [os.path.join(os.path.dirname(script_location), 'analyze_brprob.py'), temp.name, '--sorting', args.sorting]
+ p = subprocess.check_call(p)
+ sys.stdout.flush()
+
+ os.remove(temp.name)