summaryrefslogtreecommitdiffstats
path: root/llvm/tools/opt-viewer/optpmap.py
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2019-02-06 18:43:37 +0000
committerFlorian Hahn <flo@fhahn.com>2019-02-06 18:43:37 +0000
commit169f64238fe966308427a6ff794bd62563a9f4bb (patch)
tree2f2c9a9c12ea7255ecf142a6a00b53f36b14715b /llvm/tools/opt-viewer/optpmap.py
parentfeeedafd28b913fbabc43ccc37c5c0b449a11863 (diff)
downloadbcm5719-llvm-169f64238fe966308427a6ff794bd62563a9f4bb.tar.gz
bcm5719-llvm-169f64238fe966308427a6ff794bd62563a9f4bb.zip
[opt-viewer] Add --filter option to select remarks for displaying.
This allows limiting the displayed remarks to the ones with names matching the filter (regular) expression. Generating html pages for a larger project with optimization remarks can result in a huge HTML documents and using --filter allows to focus on a set of interesting remarks. Reviewers: hfinkel, anemet, thegameg, serge-sans-paille Reviewed By: anemet Differential Revision: https://reviews.llvm.org/D57827 llvm-svn: 353322
Diffstat (limited to 'llvm/tools/opt-viewer/optpmap.py')
-rw-r--r--llvm/tools/opt-viewer/optpmap.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/tools/opt-viewer/optpmap.py b/llvm/tools/opt-viewer/optpmap.py
index ff3e683f3d0..8124c8c9036 100644
--- a/llvm/tools/opt-viewer/optpmap.py
+++ b/llvm/tools/opt-viewer/optpmap.py
@@ -14,7 +14,7 @@ def _init(current, total):
def _wrapped_func(func_and_args):
- func, argument, should_print_progress = func_and_args
+ func, argument, should_print_progress, filter_ = func_and_args
if should_print_progress:
with _current.get_lock():
@@ -22,10 +22,10 @@ def _wrapped_func(func_and_args):
sys.stdout.write('\r\t{} of {}'.format(_current.value, _total.value))
sys.stdout.flush()
- return func(argument)
+ return func(argument, filter_)
-def pmap(func, iterable, processes, should_print_progress, *args, **kwargs):
+def pmap(func, iterable, processes, should_print_progress, filter_=None, *args, **kwargs):
"""
A parallel map function that reports on its progress.
@@ -40,7 +40,7 @@ def pmap(func, iterable, processes, should_print_progress, *args, **kwargs):
_current = multiprocessing.Value('i', 0)
_total = multiprocessing.Value('i', len(iterable))
- func_and_args = [(func, arg, should_print_progress,) for arg in iterable]
+ func_and_args = [(func, arg, should_print_progress, filter_) for arg in iterable]
if processes == 1:
result = list(map(_wrapped_func, func_and_args, *args, **kwargs))
else:
OpenPOWER on IntegriCloud