benchmark.py revision 0d39863d8578fb1c6e7077b2c7cc5ca79edcf4dd
1 2# Copyright (c) 2013 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6"""Define a type that wraps a Benchmark instance.""" 7 8class Benchmark(object): 9 """Class representing a benchmark to be run. 10 11 Contains details of the benchmark suite, arguments to pass to the suite, 12 iterations to run the benchmark suite and so on. Note that the benchmark name 13 can be different to the test suite name. For example, you may want to have 14 two different benchmarks which run the same test_name with different 15 arguments. 16 """ 17 18 def __init__(self, 19 name, 20 test_name, 21 test_args, 22 iterations, 23 rm_chroot_tmp, 24 perf_args, 25 suite='', 26 show_all_results=False, 27 retries=0, 28 run_local=False): 29 self.name = name 30 #For telemetry, this is the benchmark name. 31 self.test_name = test_name 32 #For telemetry, this is the data. 33 self.test_args = test_args 34 self.iterations = iterations 35 self.perf_args = perf_args 36 self.rm_chroot_tmp = rm_chroot_tmp 37 self.iteration_adjusted = False 38 self.suite = suite 39 self.show_all_results = show_all_results 40 self.retries = retries 41 if self.suite == 'telemetry': 42 self.show_all_results = True 43 if run_local and self.suite != 'telemetry_Crosperf': 44 raise Exception('run_local is only supported by telemetry_Crosperf.') 45 self.run_local = run_local 46