benchmark.py revision f2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe
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
7class Benchmark(object):
8  """Class representing a benchmark to be run.
9
10  Contains details of the benchmark suite, arguments to pass to the suite,
11  iterations to run the benchmark suite and so on. Note that the benchmark name
12  can be different to the test suite name. For example, you may want to have
13  two different benchmarks which run the same test_name with different
14  arguments.
15  """
16
17  def __init__(self,
18               name,
19               test_name,
20               test_args,
21               iterations,
22               rm_chroot_tmp,
23               perf_args,
24               suite='',
25               show_all_results=False,
26               retries=0,
27               run_local=False):
28    self.name = name
29    #For telemetry, this is the benchmark name.
30    self.test_name = test_name
31    #For telemetry, this is the data.
32    self.test_args = test_args
33    self.iterations = iterations
34    self.perf_args = perf_args
35    self.rm_chroot_tmp = rm_chroot_tmp
36    self.iteration_adjusted = False
37    self.suite = suite
38    self.show_all_results = show_all_results
39    self.retries = retries
40    if self.suite == 'telemetry':
41      self.show_all_results = True
42    if run_local and self.suite != 'telemetry_Crosperf':
43      raise Exception('run_local is only supported by telemetry_Crosperf.')
44    self.run_local = run_local
45