benchmark.py revision bc2d3d13d2e1928217140a76acdf9f9917b1fa30
1#!/usr/bin/python
2
3# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
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, name, test_name, test_args, iterations,
19               rm_chroot_tmp, perf_args, suite="",
20               show_all_results=False, retries=0, run_local=False):
21    self.name = name
22    #For telemetry, this is the benchmark name.
23    self.test_name = test_name
24    #For telemetry, this is the data.
25    self.test_args = test_args
26    self.iterations = iterations
27    self.perf_args = perf_args
28    self.rm_chroot_tmp = rm_chroot_tmp
29    self.iteration_adjusted = False
30    self.suite = suite
31    self.show_all_results = show_all_results
32    self.retries = retries
33    if self.suite == "telemetry":
34      self.show_all_results = True
35    if run_local and self.suite != 'telemetry_Crosperf':
36      raise Exception("run_local is only supported by telemetry_Crosperf.")
37    self.run_local = run_local
38