diff options
Diffstat (limited to 'utils/perf-training/perf-helper.py')
-rw-r--r-- | utils/perf-training/perf-helper.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/utils/perf-training/perf-helper.py b/utils/perf-training/perf-helper.py index 30b9caeffd58d..65afbb6ed572f 100644 --- a/utils/perf-training/perf-helper.py +++ b/utils/perf-training/perf-helper.py @@ -7,7 +7,7 @@ # #===------------------------------------------------------------------------===# -from __future__ import print_function +from __future__ import absolute_import, division, print_function import sys import os @@ -114,7 +114,7 @@ def get_cc1_command_for_args(cmd, env): # Find the cc1 command used by the compiler. To do this we execute the # compiler with '-###' to figure out what it wants to do. cmd = cmd + ['-###'] - cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env).strip() + cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env, universal_newlines=True).strip() cc_commands = [] for ln in cc_output.split('\n'): # Filter out known garbage. @@ -295,8 +295,8 @@ def form_by_frequency(symbol_lists): for a in symbols: counts[a] = counts.get(a,0) + 1 - by_count = counts.items() - by_count.sort(key = lambda (_,n): -n) + by_count = list(counts.items()) + by_count.sort(key = lambda __n: -__n[1]) return [s for s,n in by_count] def form_by_random(symbol_lists): @@ -333,14 +333,14 @@ def genOrderFile(args): help="write a list of the unordered symbols to PATH (requires --binary)", default=None, metavar="PATH") parser.add_argument("--method", dest="method", - help="order file generation method to use", choices=methods.keys(), + help="order file generation method to use", choices=list(methods.keys()), default='call_order') opts = parser.parse_args(args) # If the user gave us a binary, get all the symbols in the binary by # snarfing 'nm' output. if opts.binary_path is not None: - output = subprocess.check_output(['nm', '-P', opts.binary_path]) + output = subprocess.check_output(['nm', '-P', opts.binary_path], universal_newlines=True) lines = output.split("\n") all_symbols = [ln.split(' ',1)[0] for ln in lines |