|
@@ -0,0 +1,54 @@
|
|
|
+"""Computes the maximal value for a given selection of quantities, optimization levels
|
|
|
+ and test names."""
|
|
|
+
|
|
|
+import sys
|
|
|
+import argparse
|
|
|
+from collections import defaultdict
|
|
|
+import utils
|
|
|
+
|
|
|
+def main():
|
|
|
+ arg_parser = argparse.ArgumentParser()
|
|
|
+ arg_parser.add_argument('input', help='The performance data file.')
|
|
|
+ arg_parser.add_argument(
|
|
|
+ '-q',
|
|
|
+ '--quantity',
|
|
|
+ type=str,
|
|
|
+ help="The quantity to filter on. Defaults to '%s'" %
|
|
|
+ utils.TOTAL_TIME_QUANTITY,
|
|
|
+ default=utils.TOTAL_TIME_QUANTITY)
|
|
|
+ arg_parser.add_argument(
|
|
|
+ '-O',
|
|
|
+ '--opt',
|
|
|
+ type=str,
|
|
|
+ nargs='*',
|
|
|
+ help="Filters on optimization levels.")
|
|
|
+ arg_parser.add_argument(
|
|
|
+ '-t', '--test', type=str, nargs='*', help="Filters on tests.")
|
|
|
+
|
|
|
+ args = arg_parser.parse_args()
|
|
|
+
|
|
|
+ perf_data = utils.parse_perf_data(args.input)[args.quantity]
|
|
|
+
|
|
|
+ if args.opt:
|
|
|
+ optimization_set = set(args.opt)
|
|
|
+ perf_data = [(optimization_level, measurements)
|
|
|
+ for optimization_level, measurements in perf_data
|
|
|
+ if optimization_level in optimization_set]
|
|
|
+
|
|
|
+ if args.test:
|
|
|
+ test_set = set(args.test)
|
|
|
+ new_perf_data = []
|
|
|
+ for optimization_level, measurements in perf_data:
|
|
|
+ new_measurements = []
|
|
|
+ for test_name, data_point in measurements:
|
|
|
+ if test_name in test_set:
|
|
|
+ new_measurements.append((test_name, data_point))
|
|
|
+
|
|
|
+ if len(new_measurements) > 0:
|
|
|
+ new_perf_data.append((optimization_level, new_measurements))
|
|
|
+ perf_data = new_perf_data
|
|
|
+
|
|
|
+ print(max(max(data_point for _, data_point in measurements) for _, measurements in perf_data))
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ main()
|