[lit] Simplify --time-tests code.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 21 Aug 2013 22:26:34 +0000 (22:26 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 21 Aug 2013 22:26:34 +0000 (22:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188946 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit/main.py

index fb3614a9e569415d631652b541181208dd12e9fc..8f71685b5e25bba97cfd4c31b8eb72b3b8af74c5 100755 (executable)
@@ -407,17 +407,11 @@ def main(builtinParameters = {}):
             print('    %s' % t.getFullName())
         sys.stdout.write('\n')
 
-    if opts.timeTests:
-        # Collate, in case we repeated tests.
-        times = {}
-        for t in tests:
-            key = t.getFullName()
-            times[key] = times.get(key, 0.) + t.elapsed
-
-        byTime = list(times.items())
-        byTime.sort(key = lambda item: item[1])
-        if byTime:
-            lit.util.printHistogram(byTime, title='Tests')
+    if opts.timeTests and tests:
+        # Order by time.
+        test_times = [(t.getFullName(), t.elapsed)
+                      for t in tests]
+        lit.util.printHistogram(test_times, title='Tests')
 
     for name,code in (('Expected Passes    ', lit.Test.PASS),
                       ('Expected Failures  ', lit.Test.XFAIL),