1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/tools/opt-viewer/opt-viewer.py

278 lines
8.6 KiB
Python
Raw Normal View History

#!/usr/bin/env python2.7
from __future__ import print_function
import argparse
import cgi
import errno
import functools
from multiprocessing import cpu_count
import os.path
import re
import shutil
from pygments import highlight
from pygments.lexers.c_cpp import CppLexer
from pygments.formatters import HtmlFormatter
import optpmap
import optrecord
desc = '''Generate HTML output to visualize optimization records from the YAML files
generated with -fsave-optimization-record and -fdiagnostics-show-hotness.
The tools requires PyYAML and Pygments Python packages.'''
# This allows passing the global context to the child processes.
class Context:
def __init__(self, caller_loc = dict()):
# Map function names to their source location for function where inlining happened
self.caller_loc = caller_loc
context = Context()
class SourceFileRenderer:
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
def __init__(self, source_dir, output_dir, filename):
existing_filename = None
if os.path.exists(filename):
existing_filename = filename
else:
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
fn = os.path.join(source_dir, filename)
if os.path.exists(fn):
existing_filename = fn
self.stream = open(os.path.join(output_dir, optrecord.html_file_name(filename)), 'w')
if existing_filename:
self.source_stream = open(existing_filename)
else:
self.source_stream = None
print('''
<html>
<h1>Unable to locate file {}</h1>
</html>
'''.format(filename), file=self.stream)
self.html_formatter = HtmlFormatter(encoding='utf-8')
self.cpp_lexer = CppLexer(stripnl=False)
def render_source_lines(self, stream, line_remarks):
file_text = stream.read()
html_highlighted = highlight(
file_text,
self.cpp_lexer,
self.html_formatter).decode('utf-8')
# Take off the header and footer, these must be
# reapplied line-wise, within the page structure
html_highlighted = html_highlighted.replace('<div class="highlight"><pre>', '')
html_highlighted = html_highlighted.replace('</pre></div>', '')
for (linenum, html_line) in enumerate(html_highlighted.split('\n'), start=1):
print('''
<tr>
<td><a name=\"L{linenum}\">{linenum}</a></td>
<td></td>
<td></td>
<td><div class="highlight"><pre>{html_line}</pre></div></td>
</tr>'''.format(**locals()), file=self.stream)
for remark in line_remarks.get(linenum, []):
self.render_inline_remarks(remark, html_line)
def render_inline_remarks(self, r, line):
inlining_context = r.DemangledFunctionName
dl = context.caller_loc.get(r.Function)
if dl:
dl_dict = dict(list(dl))
link = optrecord.make_link(dl_dict['File'], dl_dict['Line'] - 2)
inlining_context = "<a href={link}>{r.DemangledFunctionName}</a>".format(**locals())
# Column is the number of characters *including* tabs, keep those and
# replace everything else with spaces.
indent = line[:max(r.Column, 1) - 1]
indent = re.sub('\S', ' ', indent)
print('''
<tr>
<td></td>
<td>{r.RelativeHotness}</td>
<td class=\"column-entry-{r.color}\">{r.PassWithDiffPrefix}</td>
<td><pre style="display:inline">{indent}</pre><span class=\"column-entry-yellow\"> {r.message}&nbsp;</span></td>
<td class=\"column-entry-yellow\">{inlining_context}</td>
</tr>'''.format(**locals()), file=self.stream)
def render(self, line_remarks):
if not self.source_stream:
return
print('''
<html>
<head>
<link rel='stylesheet' type='text/css' href='style.css'>
</head>
<body>
<div class="centered">
<table>
<tr>
<td>Line</td>
<td>Hotness</td>
<td>Optimization</td>
<td>Source</td>
<td>Inline Context</td>
</tr>''', file=self.stream)
self.render_source_lines(self.source_stream, line_remarks)
print('''
</table>
</body>
</html>''', file=self.stream)
class IndexRenderer:
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
def __init__(self, output_dir):
self.stream = open(os.path.join(output_dir, 'index.html'), 'w')
def render_entry(self, r, odd):
escaped_name = cgi.escape(r.DemangledFunctionName)
print('''
<tr>
<td class=\"column-entry-{odd}\"><a href={r.Link}>{r.DebugLocString}</a></td>
<td class=\"column-entry-{odd}\">{r.RelativeHotness}</td>
<td class=\"column-entry-{odd}\">{escaped_name}</td>
<td class=\"column-entry-{r.color}\">{r.PassWithDiffPrefix}</td>
</tr>'''.format(**locals()), file=self.stream)
def render(self, all_remarks):
print('''
<html>
<head>
<link rel='stylesheet' type='text/css' href='style.css'>
</head>
<body>
<div class="centered">
<table>
<tr>
<td>Source Location</td>
<td>Hotness</td>
<td>Function</td>
<td>Pass</td>
</tr>''', file=self.stream)
for i, remark in enumerate(all_remarks):
self.render_entry(remark, i % 2)
print('''
</table>
</body>
</html>''', file=self.stream)
def _render_file(source_dir, output_dir, ctx, entry):
global context
context = ctx
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
filename, remarks = entry
SourceFileRenderer(source_dir, output_dir, filename).render(remarks)
def map_remarks(all_remarks):
# Set up a map between function names and their source location for
# function where inlining happened
for remark in optrecord.itervalues(all_remarks):
if isinstance(remark, optrecord.Passed) and remark.Pass == "inline" and remark.Name == "Inlined":
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
for arg in remark.Args:
arg_dict = dict(list(arg))
caller = arg_dict.get('Caller')
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
if caller:
try:
context.caller_loc[caller] = arg_dict['DebugLoc']
except KeyError:
pass
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
def generate_report(all_remarks,
file_remarks,
source_dir,
output_dir,
should_display_hotness,
num_jobs,
should_print_progress):
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
try:
os.makedirs(output_dir)
except OSError as e:
if e.errno == errno.EEXIST and os.path.isdir(output_dir):
pass
else:
raise
_render_file_bound = functools.partial(_render_file, source_dir, output_dir, context)
if should_print_progress:
print('Rendering HTML files...')
optpmap.pmap(_render_file_bound,
file_remarks.items(),
num_jobs,
should_print_progress)
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
if should_display_hotness:
sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.Hotness, r.File, r.Line, r.Column, r.PassWithDiffPrefix, r.yaml_tag, r.Function), reverse=True)
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
else:
sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.File, r.Line, r.Column, r.PassWithDiffPrefix, r.yaml_tag, r.Function))
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
IndexRenderer(args.output_dir).render(sorted_remarks)
shutil.copy(os.path.join(os.path.dirname(os.path.realpath(__file__)),
"style.css"), output_dir)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=desc)
parser.add_argument(
'yaml_dirs_or_files',
nargs='+',
help='List of optimization record files or directories searched '
'for optimization record files.')
parser.add_argument(
'--output-dir',
'-o',
default='html',
help='Path to a directory where generated HTML files will be output. '
'If the directory does not already exist, it will be created. '
'"%(default)s" by default.')
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
parser.add_argument(
'--jobs',
'-j',
default=cpu_count(),
type=int,
help='Max job count (defaults to %(default)s, the current CPU count)')
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
parser.add_argument(
'-source-dir',
'-s',
default='',
help='set source directory')
parser.add_argument(
'--no-progress-indicator',
'-n',
action='store_true',
default=False,
help='Do not display any indicator of how many YAML files were read '
'or rendered into HTML.')
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
args = parser.parse_args()
print_progress = not args.no_progress_indicator
files = optrecord.find_opt_files(*args.yaml_dirs_or_files)
if not files:
parser.error("No *.opt.yaml files found")
sys.exit(1)
all_remarks, file_remarks, should_display_hotness = \
optrecord.gather_results(files, args.jobs, print_progress)
[opt-viewer] Put critical items in parallel Summary: Put opt-viewer critical items in parallel Patch by Brian Cain! Requires features from Python 2.7 **Performance** Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files. "multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505). "ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader). The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML. I suspect it would scale well on high-end servers. ``` **************************************** MULTIPROCESSING **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k 0inputs+31392outputs (0major+473540minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k 0inputs+31392outputs (0major+542022minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k 808inputs+30376outputs (0major+727994minor)pagefaults 0swaps **************************************** BASELINE **************************************** PyYAML: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: cannot import name CLoader Python 2.7.10 358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k 0inputs+31392outputs (0major+85252minor)pagefaults 0swaps PyYAML+libYAML: <class 'yaml.cyaml.CLoader'> Python 2.7.10 50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k 0inputs+31392outputs (0major+79335minor)pagefaults 0swaps PyPy/PyYAML: Traceback (most recent call last): File "<builtin>/app_main.py", line 75, in run_toplevel File "<builtin>/app_main.py", line 601, in run_it File "<string>", line 1, in <module> ImportError: cannot import name 'CLoader' Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17) [PyPy 2.6.0 with GCC 4.9.3] 72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k 0inputs+30392outputs (0major+110280minor)pagefaults 0swaps ``` Reviewers: fhahn, anemet Reviewed By: anemet Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26967 llvm-svn: 293261
2017-01-27 07:38:31 +01:00
map_remarks(all_remarks)
generate_report(all_remarks,
file_remarks,
args.source_dir,
args.output_dir,
should_display_hotness,
args.jobs,
print_progress)