Skip to content

Commit

Permalink
[opt-viewer] Make sorting for the index page deterministic
Browse files Browse the repository at this point in the history
Break the tie between entries with identical hotness deterministically.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293263 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
anemet committed Jan 27, 2017
1 parent 2c3a6b5 commit e07991d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/opt-viewer/opt-viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ def generate_report(pool, all_remarks, file_remarks, source_dir, output_dir):
pool.map(_render_file_bound, file_remarks.items())

if Remark.should_display_hotness():
sorted_remarks = sorted(all_remarks.itervalues(), key=lambda r: r.Hotness, reverse=True)
sorted_remarks = sorted(all_remarks.itervalues(), key=lambda r: (r.Hotness, r.__dict__), reverse=True)
else:
sorted_remarks = sorted(all_remarks.itervalues(), key=lambda r: (r.File, r.Line, r.Column))
sorted_remarks = sorted(all_remarks.itervalues(), key=lambda r: (r.File, r.Line, r.Column, r.__dict__))
IndexRenderer(args.output_dir).render(sorted_remarks)

shutil.copy(os.path.join(os.path.dirname(os.path.realpath(__file__)),
Expand Down

0 comments on commit e07991d

Please sign in to comment.