diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-07-01 13:22:02 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-07-01 13:22:02 +0000 |
commit | 9df3605dea17e84f8183581f6103bd0c79e2a606 (patch) | |
tree | 70a2f36ce9eb9bb213603cd7f2f120af53fc176f /utils/opt-viewer/optrecord.py | |
parent | 08bbd35a80bf7765fe0d3043f9eb5a2f2786b649 (diff) |
Diffstat (limited to 'utils/opt-viewer/optrecord.py')
-rw-r--r-- | utils/opt-viewer/optrecord.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/utils/opt-viewer/optrecord.py b/utils/opt-viewer/optrecord.py index 6dc1a32e536a2..61ed9626cffad 100644 --- a/utils/opt-viewer/optrecord.py +++ b/utils/opt-viewer/optrecord.py @@ -10,15 +10,14 @@ except ImportError: print("For faster parsing, you may want to install libYAML for PyYAML") from yaml import Loader -import functools -from collections import defaultdict -import itertools -from multiprocessing import Pool -from multiprocessing import Lock, cpu_count import cgi +from collections import defaultdict +import functools +from multiprocessing import Lock import subprocess -import traceback +import optpmap + p = subprocess.Popen(['c++filt', '-n'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) p_lock = Lock() @@ -42,8 +41,9 @@ else: def demangle(name): with p_lock: - p.stdin.write(name + '\n') - return p.stdout.readline().rstrip() + p.stdin.write((name + '\n').encode('utf-8')) + p.stdin.flush() + return p.stdout.readline().rstrip().decode('utf-8') def html_file_name(filename): @@ -209,8 +209,11 @@ def get_remarks(input_file): return max_hotness, all_remarks, file_remarks -def gather_results(pmap, filenames): - remarks = pmap(get_remarks, filenames) +def gather_results(filenames, num_jobs, should_print_progress): + if should_print_progress: + print('Reading YAML files...') + remarks = optpmap.pmap( + get_remarks, filenames, num_jobs, should_print_progress) max_hotness = max(entry[0] for entry in remarks) def merge_file_remarks(file_remarks_job, all_remarks, merged): |