Skip to content

Commit

Permalink
[lit] Print slowest test first when timing tests
Browse files Browse the repository at this point in the history
lit supports `--time-tests` which will report the 20 slowest tests and
print a nice histogram for test times.  This change prints this list and
the histogram rows by decreasing test times.  After all, we are most
interested in the slowest tests.
  • Loading branch information
Julian Lettner committed Apr 8, 2020
1 parent 2ac96d6 commit 09f3450
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/utils/lit/lit/util.py
Expand Up @@ -291,7 +291,7 @@ def printHistogram(items, title='Items'):
hr = '-' * (barW + 34)
print('\nSlowest %s:' % title)
print(hr)
for name, value in items[-20:]:
for name, value in reversed(items[-20:]):
print('%.2fs: %s' % (value, name))
print('\n%s Times:' % title)
print(hr)
Expand All @@ -304,7 +304,7 @@ def printHistogram(items, title='Items'):
'Percentage'.center(barW),
'Count'.center(cDigits * 2 + 1)))
print(hr)
for i, row in enumerate(histo):
for i, row in reversed(list(enumerate(histo))):
pct = float(len(row)) / len(items)
w = int(barW * pct)
print('[%*.*fs,%*.*fs) :: [%s%s] :: [%*d/%*d]' % (
Expand Down

0 comments on commit 09f3450

Please sign in to comment.