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

Side by Side Diff: tools/perf/metrics/timeline_unittest.py

Issue 643343002: Telemetry: Add mean-frame-time and tasks-per-frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « tools/perf/metrics/timeline.py ('k') | tools/telemetry/telemetry/util/statistics.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 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 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 4
5 import unittest 5 import unittest
6 6
7 from metrics import test_page_test_results 7 from metrics import test_page_test_results
8 from metrics import timeline 8 from metrics import timeline
9 from telemetry.timeline import model as model_module 9 from telemetry.timeline import model as model_module
10 from telemetry.web_perf import timeline_interaction_record as tir_module 10 from telemetry.web_perf import timeline_interaction_record as tir_module
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 renderer_main.BeginSlice('cat1', 'Z', 31, 20) 131 renderer_main.BeginSlice('cat1', 'Z', 31, 20)
132 renderer_main.BeginSlice('cat1', 'Z', 33, 21) 132 renderer_main.BeginSlice('cat1', 'Z', 33, 21)
133 model.FinalizeImport() 133 model.FinalizeImport()
134 134
135 # Exclude 'Z' using an action-range. 135 # Exclude 'Z' using an action-range.
136 metric = timeline.ThreadTimesTimelineMetric() 136 metric = timeline.ThreadTimesTimelineMetric()
137 metric.details_to_report = timeline.ReportMainThreadOnly 137 metric.details_to_report = timeline.ReportMainThreadOnly
138 results = self.GetResults(metric, model, renderer_main.parent, 138 results = self.GetResults(metric, model, renderer_main.parent,
139 [_GetInteractionRecord(10, 30)]) 139 [_GetInteractionRecord(10, 30)])
140 140
141 141 # Test for the results we expect.
142 # Test a couple specific results. 142 main_thread = "renderer_main"
143 assert_results = { 143 cc_thread = 'renderer_compositor'
144 timeline.ThreadCpuTimeResultName('renderer_main') : 9.75, 144 assert_results = [
145 timeline.ThreadDetailResultName('renderer_main','cat1') : 9.5, 145 (timeline.ThreadCpuTimeResultName(main_thread), 'ms', 9.75),
146 timeline.ThreadDetailResultName('renderer_main','cat2') : 0.5, 146 (timeline.ThreadTasksResultName(main_thread), 'tasks', 0.5),
147 timeline.ThreadDetailResultName('renderer_main','idle') : 0 147 (timeline.ThreadMeanFrameTimeResultName(cc_thread), 'ms', 10.0),
148 } 148 (timeline.ThreadDetailResultName(main_thread,'cat1'), 'ms', 9.5),
149 for name, value in assert_results.iteritems(): 149 (timeline.ThreadDetailResultName(main_thread,'cat2'), 'ms', 0.5),
150 results.AssertHasPageSpecificScalarValue(name, 'ms', value) 150 (timeline.ThreadDetailResultName(main_thread,'idle'), 'ms', 0)
151 ]
152 for name, unit, value in assert_results:
153 results.AssertHasPageSpecificScalarValue(name, unit, value)
151 154
152 def testOverheadIsRemoved(self): 155 def testOverheadIsRemoved(self):
153 model = model_module.TimelineModel() 156 model = model_module.TimelineModel()
154 renderer_main = model.GetOrCreateProcess(1).GetOrCreateThread(2) 157 renderer_main = model.GetOrCreateProcess(1).GetOrCreateThread(2)
155 renderer_main.name = 'CrRendererMain' 158 renderer_main.name = 'CrRendererMain'
156 159
157 # Create one frame swap. 160 # Create one frame swap.
158 cc_main = model.GetOrCreateProcess(1).GetOrCreateThread(3) 161 cc_main = model.GetOrCreateProcess(1).GetOrCreateThread(3)
159 cc_main.name = 'Compositor' 162 cc_main.name = 'Compositor'
160 cc_main.BeginSlice('cc_cat', timeline.FrameTraceName, 10, 10) 163 cc_main.BeginSlice('cc_cat', timeline.FrameTraceName, 10, 10)
(...skipping 14 matching lines...) Expand all
175 metric.details_to_report = timeline.ReportMainThreadOnly 178 metric.details_to_report = timeline.ReportMainThreadOnly
176 results = self.GetResults(metric, model, renderer_main.parent, 179 results = self.GetResults(metric, model, renderer_main.parent,
177 [_GetInteractionRecord(10, 30)]) 180 [_GetInteractionRecord(10, 30)])
178 181
179 # Test a couple specific results. 182 # Test a couple specific results.
180 assert_results = { 183 assert_results = {
181 timeline.ThreadCpuTimeResultName('renderer_main') : 9.0, 184 timeline.ThreadCpuTimeResultName('renderer_main') : 9.0,
182 } 185 }
183 for name, value in assert_results.iteritems(): 186 for name, value in assert_results.iteritems():
184 results.AssertHasPageSpecificScalarValue(name, 'ms', value) 187 results.AssertHasPageSpecificScalarValue(name, 'ms', value)
OLDNEW
« no previous file with comments | « tools/perf/metrics/timeline.py ('k') | tools/telemetry/telemetry/util/statistics.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698