Fix import error in mac_platform_backend.py
[chromium-blink-merge.git] / tools / perf / metrics / __init__.py
blob93d13c6fa60f1ea591a8fdbb29678dd88bb92ae1
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 class Metric(object):
6 """Base class for all the metrics that are used by telemetry measurements.
8 The Metric class represents a way of measuring something. Metrics are
9 helper classes used by PageMeasurements. Each PageMeasurement may use
10 multiple metrics; each metric should be focussed on collecting data
11 about one thing.
12 """
14 @classmethod
15 def CustomizeBrowserOptions(cls, options):
16 """Add browser options that are required by this metric.
18 Some metrics do not have any special browser options that need
19 to be added, and they do not need to override this method; by
20 default, no browser options are added.
22 To add options here, call options.AppendExtraBrowserArgs(arg).
23 """
24 pass
26 def Start(self, page, tab):
27 """Start collecting data for this metric."""
28 pass
30 def Stop(self, page, tab):
31 """Stop collecting data for this metric (if applicable)."""
32 pass
34 def AddResults(self, tab, results):
35 """Add the data collected into the results object for a measurement.
37 Metrics may implement AddResults to provide a common way to add results
38 to the PageMeasurementResults in PageMeasurement.AddMeasurement --
39 results should be added with results.Add(trace_name, unit, value).
40 """
41 raise NotImplementedError()