aboutsummaryrefslogtreecommitdiff
path: root/crosperf/benchmark.py
blob: a2a34bcadf31e0f93f0eb78f9e30e25a19401c09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""Define a type that wraps a Benchmark instance."""

class Benchmark(object):
  """Class representing a benchmark to be run.

  Contains details of the benchmark suite, arguments to pass to the suite,
  iterations to run the benchmark suite and so on. Note that the benchmark name
  can be different to the test suite name. For example, you may want to have
  two different benchmarks which run the same test_name with different
  arguments.
  """

  def __init__(self,
               name,
               test_name,
               test_args,
               iterations,
               rm_chroot_tmp,
               perf_args,
               suite='',
               show_all_results=False,
               retries=0,
               run_local=False):
    self.name = name
    #For telemetry, this is the benchmark name.
    self.test_name = test_name
    #For telemetry, this is the data.
    self.test_args = test_args
    self.iterations = iterations
    self.perf_args = perf_args
    self.rm_chroot_tmp = rm_chroot_tmp
    self.iteration_adjusted = False
    self.suite = suite
    self.show_all_results = show_all_results
    self.retries = retries
    if self.suite == 'telemetry':
      self.show_all_results = True
    if run_local and self.suite != 'telemetry_Crosperf':
      raise RuntimeError('run_local is only supported by telemetry_Crosperf.')
    self.run_local = run_local