[llvm] 0bc2eab - [lit] Print slowest tests and time histogram before result groups
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 7 22:22:19 PDT 2020
Author: Julian Lettner
Date: 2020-04-07T22:19:50-07:00
New Revision: 0bc2eab6f5cd522eb83b2b862ce8a2651c97ee59
URL: https://github.com/llvm/llvm-project/commit/0bc2eab6f5cd522eb83b2b862ce8a2651c97ee59
DIFF: https://github.com/llvm/llvm-project/commit/0bc2eab6f5cd522eb83b2b862ce8a2651c97ee59.diff
LOG: [lit] Print slowest tests and time histogram before result groups
Added:
Modified:
llvm/utils/lit/lit/cl_arguments.py
llvm/utils/lit/lit/main.py
llvm/utils/lit/lit/util.py
Removed:
################################################################################
diff --git a/llvm/utils/lit/lit/cl_arguments.py b/llvm/utils/lit/lit/cl_arguments.py
index ee7527538adc..4e185dee900f 100644
--- a/llvm/utils/lit/lit/cl_arguments.py
+++ b/llvm/utils/lit/lit/cl_arguments.py
@@ -91,7 +91,6 @@ def parse_args():
action="append",
default=[])
execution_group.add_argument("--time-tests",
- dest="timeTests",
help="Track elapsed wall time for each test",
action="store_true")
execution_group.add_argument("--no-execute",
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index 80eb1d57e291..73e33f530acd 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -91,6 +91,9 @@ def main(builtin_params={}):
executed_tests = [t for t in filtered_tests if t.result]
+ if opts.time_tests:
+ print_histogram(executed_tests)
+
print_results(executed_tests, elapsed, opts)
if opts.output_path:
@@ -239,6 +242,11 @@ def execute_in_tmp_dir(run, lit_config):
lit_config.warning("Failed to delete temp directory '%s'" % tmp_dir)
+def print_histogram(tests):
+ test_times = [(t.getFullName(), t.result.elapsed) for t in tests]
+ lit.util.printHistogram(test_times, title='Tests')
+
+
# Status code, summary label, group label
failure_codes = [
(lit.Test.UNRESOLVED, 'Unresolved Tests', 'Unresolved'),
@@ -263,10 +271,6 @@ def print_results(tests, elapsed, opts):
for (code, _, group_label) in all_codes:
print_group(code, group_label, tests_by_code[code], opts)
- if opts.timeTests and tests:
- test_times = [(t.getFullName(), t.result.elapsed) for t in tests]
- lit.util.printHistogram(test_times, title='Tests')
-
print_summary(tests_by_code, opts.quiet, elapsed)
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index ac75f248dcb6..19942d07d1f5 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -289,7 +289,7 @@ def printHistogram(items, title='Items'):
barW = 40
hr = '-' * (barW + 34)
- print('\nSlowest %s:' % title)
+ print('Slowest %s:' % title)
print(hr)
for name, value in reversed(items[-20:]):
print('%.2fs: %s' % (value, name))
@@ -310,6 +310,7 @@ def printHistogram(items, title='Items'):
print('[%*.*fs,%*.*fs) :: [%s%s] :: [%*d/%*d]' % (
pDigits, pfDigits, i * barH, pDigits, pfDigits, (i + 1) * barH,
'*' * w, ' ' * (barW - w), cDigits, len(row), cDigits, len(items)))
+ print(hr)
class ExecuteCommandTimeoutException(Exception):
More information about the llvm-commits
mailing list