[llvm] r318135 - [opt-viewer] With hotness only show max 1000 entries on the index page
Adam Nemet via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 13 20:37:33 PST 2017
Author: anemet
Date: Mon Nov 13 20:37:32 2017
New Revision: 318135
URL: http://llvm.org/viewvc/llvm-project?rev=318135&view=rev
Log:
[opt-viewer] With hotness only show max 1000 entries on the index page
Adjustable with an option.
Modified:
llvm/trunk/tools/opt-viewer/opt-viewer.py
Modified: llvm/trunk/tools/opt-viewer/opt-viewer.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt-viewer/opt-viewer.py?rev=318135&r1=318134&r2=318135&view=diff
==============================================================================
--- llvm/trunk/tools/opt-viewer/opt-viewer.py (original)
+++ llvm/trunk/tools/opt-viewer/opt-viewer.py Mon Nov 13 20:37:32 2017
@@ -136,8 +136,9 @@ class SourceFileRenderer:
class IndexRenderer:
- def __init__(self, output_dir):
+ def __init__(self, output_dir, should_display_hotness):
self.stream = open(os.path.join(output_dir, 'index.html'), 'w')
+ self.should_display_hotness = should_display_hotness
def render_entry(self, r, odd):
escaped_name = cgi.escape(r.DemangledFunctionName)
@@ -164,7 +165,12 @@ class IndexRenderer:
<td>Function</td>
<td>Pass</td>
</tr>''', file=self.stream)
- for i, remark in enumerate(all_remarks):
+
+ max_entries = None
+ if should_display_hotness:
+ max_entries = args.max_hottest_remarks_on_index
+
+ for i, remark in enumerate(all_remarks[:max_entries]):
self.render_entry(remark, i % 2)
print('''
</table>
@@ -221,7 +227,7 @@ def generate_report(all_remarks,
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)
else:
sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.File, r.Line, r.Column, r.PassWithDiffPrefix, r.yaml_tag, r.Function))
- IndexRenderer(args.output_dir).render(sorted_remarks)
+ IndexRenderer(args.output_dir, should_display_hotness).render(sorted_remarks)
shutil.copy(os.path.join(os.path.dirname(os.path.realpath(__file__)),
"style.css"), output_dir)
@@ -259,6 +265,11 @@ if __name__ == '__main__':
default=False,
help='Do not display any indicator of how many YAML files were read '
'or rendered into HTML.')
+ parser.add_argument(
+ '--max-hottest-remarks-on-index',
+ default=1000,
+ type=int,
+ help='Maximum number of the hottest remarks to appear on the index page')
args = parser.parse_args()
print_progress = not args.no_progress_indicator
More information about the llvm-commits
mailing list