mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 04:56:06 +00:00
[opt-viewer] With hotness only show max 1000 entries on the index page
Adjustable with an option. llvm-svn: 318135
This commit is contained in:
parent
8443bcc898
commit
edfc869151
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user