Skip to content

Commit 0bc2eab

Browse files
author
Julian Lettner
committed
[lit] Print slowest tests and time histogram before result groups
1 parent 4147450 commit 0bc2eab

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

llvm/utils/lit/lit/cl_arguments.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def parse_args():
9191
action="append",
9292
default=[])
9393
execution_group.add_argument("--time-tests",
94-
dest="timeTests",
9594
help="Track elapsed wall time for each test",
9695
action="store_true")
9796
execution_group.add_argument("--no-execute",

llvm/utils/lit/lit/main.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def main(builtin_params={}):
9191

9292
executed_tests = [t for t in filtered_tests if t.result]
9393

94+
if opts.time_tests:
95+
print_histogram(executed_tests)
96+
9497
print_results(executed_tests, elapsed, opts)
9598

9699
if opts.output_path:
@@ -239,6 +242,11 @@ def execute_in_tmp_dir(run, lit_config):
239242
lit_config.warning("Failed to delete temp directory '%s'" % tmp_dir)
240243

241244

245+
def print_histogram(tests):
246+
test_times = [(t.getFullName(), t.result.elapsed) for t in tests]
247+
lit.util.printHistogram(test_times, title='Tests')
248+
249+
242250
# Status code, summary label, group label
243251
failure_codes = [
244252
(lit.Test.UNRESOLVED, 'Unresolved Tests', 'Unresolved'),
@@ -263,10 +271,6 @@ def print_results(tests, elapsed, opts):
263271
for (code, _, group_label) in all_codes:
264272
print_group(code, group_label, tests_by_code[code], opts)
265273

266-
if opts.timeTests and tests:
267-
test_times = [(t.getFullName(), t.result.elapsed) for t in tests]
268-
lit.util.printHistogram(test_times, title='Tests')
269-
270274
print_summary(tests_by_code, opts.quiet, elapsed)
271275

272276

llvm/utils/lit/lit/util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def printHistogram(items, title='Items'):
289289

290290
barW = 40
291291
hr = '-' * (barW + 34)
292-
print('\nSlowest %s:' % title)
292+
print('Slowest %s:' % title)
293293
print(hr)
294294
for name, value in reversed(items[-20:]):
295295
print('%.2fs: %s' % (value, name))
@@ -310,6 +310,7 @@ def printHistogram(items, title='Items'):
310310
print('[%*.*fs,%*.*fs) :: [%s%s] :: [%*d/%*d]' % (
311311
pDigits, pfDigits, i * barH, pDigits, pfDigits, (i + 1) * barH,
312312
'*' * w, ' ' * (barW - w), cDigits, len(row), cDigits, len(items)))
313+
print(hr)
313314

314315

315316
class ExecuteCommandTimeoutException(Exception):

0 commit comments

Comments
 (0)