Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2838)

Unified Diff: chrome/test/media_router/telemetry/benchmarks/media_router_metric.py

Issue 1843063004: Add new Telemetry tests to get CPU and memory usage for idle and flinging two test scenarios. Mirro… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN build failure Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/media_router/telemetry/benchmarks/media_router_metric.py
diff --git a/chrome/test/media_router/telemetry/benchmarks/media_router_metric.py b/chrome/test/media_router/telemetry/benchmarks/media_router_metric.py
deleted file mode 100644
index 0439b58dac5d9d76ac6c49ef0a42ab8641208454..0000000000000000000000000000000000000000
--- a/chrome/test/media_router/telemetry/benchmarks/media_router_metric.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import json
-
-from telemetry.value import histogram
-from telemetry.value import histogram_util
-from telemetry.value import scalar
-
-from metrics import Metric
-
-HISTOGRAMS_TO_RECORD = [
- {
- 'name': 'MediaRouter.Ui.Dialog.LoadedWithData', 'units': 'ms',
- 'display_name': 'dialog_loaded_with_data',
- 'type': histogram_util.BROWSER_HISTOGRAM,
- 'description': 'The latency to render the media router dialog with data.',
- },
- {
- 'name': 'MediaRouter.Ui.Dialog.Paint', 'units': 'ms',
- 'display_name': 'dialog_paint',
- 'type': histogram_util.BROWSER_HISTOGRAM,
- 'description': 'The latency to paint the media router dialog.',
- }]
-
-
-class MediaRouterMetric(Metric):
- "A metric for media router dialog latency from histograms."
-
- def __init__(self):
- super(MediaRouterMetric, self).__init__()
- self._histogram_start = dict()
- self._histogram_delta = dict()
- self._started = False
-
- def Start(self, page, tab):
- self._started = True
-
- for h in HISTOGRAMS_TO_RECORD:
- histogram_data = histogram_util.GetHistogram(
- h['type'], h['name'], tab)
- # Histogram data may not be available
- if not histogram_data:
- continue
- self._histogram_start[h['name']] = histogram_data
-
- def Stop(self, page, tab):
- assert self._started, 'Must call Start() first'
- for h in HISTOGRAMS_TO_RECORD:
- # Histogram data may not be available
- if h['name'] not in self._histogram_start:
- continue
- histogram_data = histogram_util.GetHistogram(
- h['type'], h['name'], tab)
-
- if not histogram_data:
- continue
- self._histogram_delta[h['name']] = histogram_util.SubtractHistogram(
- histogram_data, self._histogram_start[h['name']])
-
- def AddResults(self, tab, results):
- assert self._histogram_delta, 'Must call Stop() first'
- for h in HISTOGRAMS_TO_RECORD:
- # Histogram data may not be available
- if h['name'] not in self._histogram_delta:
- continue
- results.AddValue(histogram.HistogramValue(
- results.current_page, h['display_name'], h['units'],
- raw_value_json=self._histogram_delta[h['name']], important=False,
- description=h.get('description')))

Powered by Google App Engine
This is Rietveld 408576698