[PATCH] D144101: [test-suite] Increase the --filter-short threshold

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 06:11:56 PDT 2023


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rTf36619ce1b38: compare.py: increase --filter-short threshold, and accept optional argument (authored by SjoerdMeijer).

Repository:
  rT test-suite

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144101/new/

https://reviews.llvm.org/D144101

Files:
  utils/compare.py


Index: utils/compare.py
===================================================================
--- utils/compare.py
+++ utils/compare.py
@@ -154,7 +154,7 @@
 def filter_failed(data, key='Exec'):
     return data.loc[data[key] == "pass"]
 
-def filter_short(data, key='Exec_Time', threshold=0.6):
+def filter_short(data, threshold, key='Exec_Time'):
     return data.loc[data[key] >= threshold]
 
 def filter_same_hash(data, key='hash'):
@@ -293,8 +293,9 @@
     parser.add_argument('--diff', action='store_true', dest='show_diff')
     parser.add_argument('--absolute-diff', action='store_true',
                         help='Use an absolute instead of a relative difference')
-    parser.add_argument('--filter-short', action='store_true',
-                        dest='filter_short')
+    parser.add_argument('--filter-short', nargs='?',
+                        dest='filter_short', default=None,
+                        help="Filter benchmarks with execution times less than N seconds (default 1.0s)")
     parser.add_argument('--no-filter-failed', action='store_false',
                         dest='filter_failed', default=True)
     parser.add_argument('--filter-hash', action='store_true',
@@ -322,6 +323,24 @@
     if config.show_diff is None:
         config.show_diff = len(config.files) > 1
 
+    # If only --filter-short is provided, i.e. its optional argument is
+    # omitted, we default to threshold of 1 second to filter out apps and
+    # results with a execution time less than that.
+    filter_short_threshold = 1.0
+
+    # If the optional argument to --filter-short is omitted, we need to take
+    # care of this case and command line:
+    #     --filter-short FILE [FILE ...]
+    # I.e., we need to recognise that FILE is not the optional argument to
+    # --filter-short. The way we do this, is to try converting the option value
+    # to a float, and if that fails, we insert it back into the files list (in
+    # the first position).
+    if config.filter_short is not None:
+        try:
+            filter_short_threshold = float(config.filter_short)
+        except:
+            config.files.insert(0, config.filter_short)
+
     # Read inputs
     files = config.files
     if "vs" in files:
@@ -373,7 +392,7 @@
         newdata = newdata.drop('Exec', 1)
         data = newdata
     if config.filter_short:
-        newdata = filter_short(data, metric)
+        newdata = filter_short(data, filter_short_threshold, metric)
         print_filter_stats("Short Running", data, newdata)
         data = newdata
     if config.filter_hash and 'hash' in data.columns and \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144101.506560.patch
Type: text/x-patch
Size: 2611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230320/ecb730e6/attachment.bin>


More information about the llvm-commits mailing list