[llvm] 09f3450 - [lit] Print slowest test first when timing tests
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 7 18:27:47 PDT 2020
Author: Julian Lettner
Date: 2020-04-07T18:18:33-07:00
New Revision: 09f345080edbc914e2d864e9ccf50c94d90d35c5
URL: https://github.com/llvm/llvm-project/commit/09f345080edbc914e2d864e9ccf50c94d90d35c5
DIFF: https://github.com/llvm/llvm-project/commit/09f345080edbc914e2d864e9ccf50c94d90d35c5.diff
LOG: [lit] Print slowest test first when timing tests
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.
Added:
Modified:
llvm/utils/lit/lit/util.py
Removed:
################################################################################
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index ab51988e21ec..ac75f248dcb6 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -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)
@@ -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]' % (
More information about the llvm-commits
mailing list