diff options
author | Alexandre Rames <alexandre.rames@linaro.org> | 2015-08-27 11:14:14 +0100 |
---|---|---|
committer | Alexandre Rames <alexandre.rames@linaro.org> | 2015-09-15 08:43:42 +0000 |
commit | 5cc4e8cdfd37aa281811bbe0a4a00eb9edc79e3c (patch) | |
tree | 534677f2d2328ac9ff03365c849a4636fec02f45 | |
parent | 18e8f0a5e8a59a16e73ced36b1c40da3f750b412 (diff) |
Add a new `--filter-out` option.
This option allows to not run some benchmarks. By default it is set to ignore
all deprecated benchmarks.
Multiple filter can be combined. For example:
./run.py --filter "deprecated/Factorial*" --filter-out "deprecated/FactorialFloat"
Change-Id: I3fb868677451520ae1a06019e2e92c72bf909510
-rwxr-xr-x | benchmarking/java-ubenchs/run.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/benchmarking/java-ubenchs/run.py b/benchmarking/java-ubenchs/run.py index 6d0d13a..2d49cdb 100755 --- a/benchmarking/java-ubenchs/run.py +++ b/benchmarking/java-ubenchs/run.py @@ -79,8 +79,11 @@ def BuildOptions(): default = default_remote_copy_path, help = '''Path where objects should be copied on the target.''') - parser.add_argument('-f', '--filter', action = 'store', default = '*', + parser.add_argument('-f', '--filter', action = 'append', help='Quoted (benchmark name) filter pattern.') + parser.add_argument('-F', '--filter-out', action = 'append', + help='''Filter out the benchmarks matching this patern. + (default: [\'deprecated/*\']''') parser.add_argument('--output-pkl', action = 'store', help='Specify a name for the output `.pkl` file.') return parser.parse_args() @@ -224,10 +227,16 @@ def ListAllBenchmarks(): return list_benchs -def FilterBenchmarks(benchmarks, filter): - if filter is not None: - benchmarks = [x for x in benchmarks if fnmatch.fnmatch(x, filter)] - return benchmarks +def FilterBenchmarks(benchmarks, filter, filter_out): + res = benchmarks + if filter: + res = [] + for f in filter: + res += [x for x in benchmarks if fnmatch.fnmatch(x, f)] + if filter_out: + for f in filter_out: + res = [x for x in res if not fnmatch.fnmatch(x, f)] + return res if __name__ == "__main__": @@ -248,7 +257,14 @@ if __name__ == "__main__": sys.exit(0) benchmarks = ListAllBenchmarks() - benchmarks = FilterBenchmarks(benchmarks, args.filter) + + # The deprecated benchmarks should not be implicitly filtered out when + # filters are explicitly specified on the command line. + if args.filter is not None or args.filter_out is not None: + filter_out = args.filter_out + else: + filter_out = ['deprecated/*'] + benchmarks = FilterBenchmarks(benchmarks, args.filter, filter_out) bench_class_names = list(map(os.path.basename, benchmarks)) RunBenchs(remote_apk, bench_class_names, args.run_on_host, args.auto_calibrate, args.iterations, args.mode) |