__init__.py 1017 B

12345678910111213141516171819202122232425262728
  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.
  4. class Metric(object):
  5. """Base class for all the metrics that are used by telemetry measurements.
  6. The Metric class represents a way of measuring something. Metrics are
  7. helper classes used by PageTests. Each PageTest may use
  8. multiple metrics; each metric should be focused on collecting data
  9. about one thing.
  10. """
  11. def Start(self, page, tab):
  12. """Start collecting data for this metric."""
  13. def Stop(self, page, tab):
  14. """Stop collecting data for this metric (if applicable)."""
  15. def AddResults(self, tab, results):
  16. """Add the data collected into the results object for a measurement.
  17. Metrics may implement AddResults to provide a common way to add results
  18. to the PageTestResults in PageTest.ValidateOrMeasurePage --
  19. results should be added with results.AddMeasurement(...).
  20. """
  21. raise NotImplementedError()