llvm.org GIT mirror llvm / 0c383f6
[opt-viewer] With hotness only show max 1000 entries on the index page Adjustable with an option. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318135 91177308-0d34-0410-b5e6-96231b3b80d8 Adam Nemet 1 year, 9 months ago
1 changed file(s) with 14 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
''', file=self.stream)
135135
136136
137137 class IndexRenderer:
138 def __init__(self, output_dir):
138 def __init__(self, output_dir, should_display_hotness):
139139 self.stream = open(os.path.join(output_dir, 'index.html'), 'w')
140 self.should_display_hotness = should_display_hotness
140141
141142 def render_entry(self, r, odd):
142143 escaped_name = cgi.escape(r.DemangledFunctionName)
163164 Function
164165 Pass
165166
166 for i, remark in enumerate(all_remarks):
167
168 max_entries = None
169 if should_display_hotness:
170 max_entries = args.max_hottest_remarks_on_index
171
172 for i, remark in enumerate(all_remarks[:max_entries]):
167173 self.render_entry(remark, i % 2)
168174 print('''
169175
220226 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) 221227 else: 222228 sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.File, r.Line, r.Column, r.PassWithDiffPrefix, r.yaml_tag, r.Function)) 223 IndexRenderer(args.output_dir).render(sorted_remarks) 229 IndexRenderer(args.output_dir, should_display_hotness).render(sorted_remarks) 224230 225231 shutil.copy(os.path.join(os.path.dirname(os.path.realpath(__file__)), 226232 "style.css"), output_dir) 258264 default=False, 259265 help='Do not display any indicator of how many YAML files were read ' 260266 'or rendered into HTML.') 267 parser.add_argument( 268 '--max-hottest-remarks-on-index', 269 default=1000, 270 type=int, 271 help='Maximum number of the hottest remarks to appear on the index page') 261272 args = parser.parse_args() 262273 263274 print_progress = not args.no_progress_indicator