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

Side by Side Diff: tools/telemetry/telemetry/web_perf/timeline_based_measurement.py

Issue 1254023003: Telemetry Test for WebRTC Rendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use telemetry stats functions. Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 import collections 4 import collections
5 import logging 5 import logging
6 from collections import defaultdict 6 from collections import defaultdict
7 7
8 from telemetry.timeline import model as model_module 8 from telemetry.timeline import model as model_module
9 from telemetry.timeline import tracing_category_filter 9 from telemetry.timeline import tracing_category_filter
10 from telemetry.timeline import tracing_options 10 from telemetry.timeline import tracing_options
11 from telemetry.value import trace 11 from telemetry.value import trace
12 from telemetry.web_perf.metrics import timeline_based_metric 12 from telemetry.web_perf.metrics import timeline_based_metric
13 from telemetry.web_perf.metrics import blob_timeline 13 from telemetry.web_perf.metrics import blob_timeline
14 from telemetry.web_perf.metrics import webrtc_rendering_timeline
14 from telemetry.web_perf.metrics import gpu_timeline 15 from telemetry.web_perf.metrics import gpu_timeline
15 from telemetry.web_perf.metrics import indexeddb_timeline 16 from telemetry.web_perf.metrics import indexeddb_timeline
16 from telemetry.web_perf.metrics import layout 17 from telemetry.web_perf.metrics import layout
17 from telemetry.web_perf.metrics import memory_timeline 18 from telemetry.web_perf.metrics import memory_timeline
18 from telemetry.web_perf.metrics import responsiveness_metric 19 from telemetry.web_perf.metrics import responsiveness_metric
19 from telemetry.web_perf.metrics import smoothness 20 from telemetry.web_perf.metrics import smoothness
20 from telemetry.web_perf.metrics import text_selection 21 from telemetry.web_perf.metrics import text_selection
21 from telemetry.web_perf import smooth_gesture_util 22 from telemetry.web_perf import smooth_gesture_util
22 from telemetry.web_perf import story_test 23 from telemetry.web_perf import story_test
23 from telemetry.web_perf import timeline_interaction_record as tir_module 24 from telemetry.web_perf import timeline_interaction_record as tir_module
(...skipping 17 matching lines...) Expand all
41 # TODO(nednguyen): use discovery pattern to return all the instances of 42 # TODO(nednguyen): use discovery pattern to return all the instances of
42 # all TimelineBasedMetrics class in web_perf/metrics/ folder. 43 # all TimelineBasedMetrics class in web_perf/metrics/ folder.
43 # This cannot be done until crbug.com/460208 is fixed. 44 # This cannot be done until crbug.com/460208 is fixed.
44 return (smoothness.SmoothnessMetric(), 45 return (smoothness.SmoothnessMetric(),
45 responsiveness_metric.ResponsivenessMetric(), 46 responsiveness_metric.ResponsivenessMetric(),
46 layout.LayoutMetric(), 47 layout.LayoutMetric(),
47 gpu_timeline.GPUTimelineMetric(), 48 gpu_timeline.GPUTimelineMetric(),
48 blob_timeline.BlobTimelineMetric(), 49 blob_timeline.BlobTimelineMetric(),
49 memory_timeline.MemoryTimelineMetric(), 50 memory_timeline.MemoryTimelineMetric(),
50 text_selection.TextSelectionMetric(), 51 text_selection.TextSelectionMetric(),
51 indexeddb_timeline.IndexedDBTimelineMetric()) 52 indexeddb_timeline.IndexedDBTimelineMetric(),
53 webrtc_rendering_timeline.WebRtcRenderingTimelineMetric())
52 54
53 55
54 class InvalidInteractions(Exception): 56 class InvalidInteractions(Exception):
55 pass 57 pass
56 58
57 59
58 # TODO(nednguyen): Get rid of this results wrapper hack after we add interaction 60 # TODO(nednguyen): Get rid of this results wrapper hack after we add interaction
59 # record to telemetry value system (crbug.com/453109) 61 # record to telemetry value system (crbug.com/453109)
60 class ResultsWrapperInterface(object): 62 class ResultsWrapperInterface(object):
61 def __init__(self): 63 def __init__(self):
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 supported long term and to be removed when crbug.com/453109 is resolved. 248 supported long term and to be removed when crbug.com/453109 is resolved.
247 """ 249 """
248 def __init__(self, options, results_wrapper=None): 250 def __init__(self, options, results_wrapper=None):
249 self._tbm_options = options 251 self._tbm_options = options
250 self._results_wrapper = results_wrapper or _TBMResultWrapper() 252 self._results_wrapper = results_wrapper or _TBMResultWrapper()
251 253
252 def WillRunStory(self, platform): 254 def WillRunStory(self, platform):
253 """Configure and start tracing.""" 255 """Configure and start tracing."""
254 if not platform.tracing_controller.IsChromeTracingSupported(): 256 if not platform.tracing_controller.IsChromeTracingSupported():
255 raise Exception('Not supported') 257 raise Exception('Not supported')
256
257 platform.tracing_controller.Start(self._tbm_options.tracing_options, 258 platform.tracing_controller.Start(self._tbm_options.tracing_options,
258 self._tbm_options.category_filter) 259 self._tbm_options.category_filter)
259 260
260 def Measure(self, platform, results): 261 def Measure(self, platform, results):
261 """Collect all possible metrics and added them to results.""" 262 """Collect all possible metrics and added them to results."""
262 trace_result = platform.tracing_controller.Stop() 263 trace_result = platform.tracing_controller.Stop()
263 results.AddValue(trace.TraceValue(results.current_page, trace_result)) 264 results.AddValue(trace.TraceValue(results.current_page, trace_result))
264 model = model_module.TimelineModel(trace_result) 265 model = model_module.TimelineModel(trace_result)
265 threads_to_records_map = _GetRendererThreadsToInteractionRecordsMap(model) 266 threads_to_records_map = _GetRendererThreadsToInteractionRecordsMap(model)
266 if (len(threads_to_records_map.values()) == 0 and 267 if (len(threads_to_records_map.values()) == 0 and
267 self._tbm_options.tracing_options.enable_chrome_trace): 268 self._tbm_options.tracing_options.enable_chrome_trace):
268 raise story_test.Failure( 269 raise story_test.Failure(
269 'No timeline interaction records were recorded in the trace. ' 270 'No timeline interaction records were recorded in the trace. '
270 'This could be caused by console.time() & console.timeEnd() execution' 271 'This could be caused by console.time() & console.timeEnd() execution'
271 ' failure or the tracing category specified doesn\'t include ' 272 ' failure or the tracing category specified doesn\'t include '
272 'blink.console categories.') 273 'blink.console categories.')
273 for renderer_thread, interaction_records in ( 274 for renderer_thread, interaction_records in (
274 threads_to_records_map.iteritems()): 275 threads_to_records_map.iteritems()):
275 meta_metrics = _TimelineBasedMetrics( 276 meta_metrics = _TimelineBasedMetrics(
276 model, renderer_thread, interaction_records, 277 model, renderer_thread, interaction_records,
277 self._results_wrapper, self._tbm_options.GetTimelineBasedMetrics()) 278 self._results_wrapper, self._tbm_options.GetTimelineBasedMetrics())
278 meta_metrics.AddResults(results) 279 meta_metrics.AddResults(results)
279 280
280 def DidRunStory(self, platform): 281 def DidRunStory(self, platform):
281 """Clean up after running the story.""" 282 """Clean up after running the story."""
282 if platform.tracing_controller.is_tracing_running: 283 if platform.tracing_controller.is_tracing_running:
283 platform.tracing_controller.Stop() 284 platform.tracing_controller.Stop()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698