summaryrefslogtreecommitdiff
path: root/utils/opt-viewer/optrecord.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils/opt-viewer/optrecord.py')
-rw-r--r--utils/opt-viewer/optrecord.py23
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):