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

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

Issue 171013006: Telemetry: Use mimimum tracing for timeline benchmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove @property. Created 6 years, 10 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') | no next file » | 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 timeline 7 from metrics import timeline
8 from telemetry.core.timeline import bounds 8 from telemetry.core.timeline import bounds
9 from telemetry.core.timeline import model as model_module 9 from telemetry.core.timeline import model as model_module
10 from telemetry.page import page as page_module 10 from telemetry.page import page as page_module
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 renderer_main = model.GetOrCreateProcess(1).GetOrCreateThread(2) 102 renderer_main = model.GetOrCreateProcess(1).GetOrCreateThread(2)
103 renderer_main.name = 'CrRendererMain' 103 renderer_main.name = 'CrRendererMain'
104 104
105 metric = timeline.ThreadTimesTimelineMetric() 105 metric = timeline.ThreadTimesTimelineMetric()
106 metric._action_ranges = [self.GetActionRange(1, 2)] 106 metric._action_ranges = [self.GetActionRange(1, 2)]
107 metric.details_to_report = timeline.ReportMainThreadOnly 107 metric.details_to_report = timeline.ReportMainThreadOnly
108 results = self.GetResultsForModel(metric, model) 108 results = self.GetResultsForModel(metric, model)
109 109
110 # Test that all result thread categories exist 110 # Test that all result thread categories exist
111 for name in timeline.TimelineThreadCategories.values(): 111 for name in timeline.TimelineThreadCategories.values():
112 results.GetPageSpecificValueNamed(timeline.ThreadTimeResultName(name))
113 results.GetPageSpecificValueNamed(timeline.ThreadCpuTimeResultName(name)) 112 results.GetPageSpecificValueNamed(timeline.ThreadCpuTimeResultName(name))
114 113
115 def testBasic(self): 114 def testBasic(self):
116 model = model_module.TimelineModel() 115 model = model_module.TimelineModel()
117 renderer_main = model.GetOrCreateProcess(1).GetOrCreateThread(2) 116 renderer_main = model.GetOrCreateProcess(1).GetOrCreateThread(2)
118 renderer_main.name = 'CrRendererMain' 117 renderer_main.name = 'CrRendererMain'
119 118
120 # Create two frame swaps (Results times should be divided by two) 119 # Create two frame swaps (Results times should be divided by two)
121 cc_main = model.GetOrCreateProcess(1).GetOrCreateThread(3) 120 cc_main = model.GetOrCreateProcess(1).GetOrCreateThread(3)
122 cc_main.name = 'Compositor' 121 cc_main.name = 'Compositor'
(...skipping 13 matching lines...) Expand all
136 model.FinalizeImport() 135 model.FinalizeImport()
137 136
138 # Exclude 'Z' using an action-range. 137 # Exclude 'Z' using an action-range.
139 metric = timeline.ThreadTimesTimelineMetric() 138 metric = timeline.ThreadTimesTimelineMetric()
140 metric._action_ranges = [self.GetActionRange(10, 30)] 139 metric._action_ranges = [self.GetActionRange(10, 30)]
141 metric.details_to_report = timeline.ReportMainThreadOnly 140 metric.details_to_report = timeline.ReportMainThreadOnly
142 results = self.GetResultsForModel(metric, model) 141 results = self.GetResultsForModel(metric, model)
143 142
144 # Test a couple specific results. 143 # Test a couple specific results.
145 assert_results = { 144 assert_results = {
146 timeline.ThreadTimeResultName('renderer_main') : 10, 145 timeline.ThreadCpuTimeResultName('renderer_main') : 9.75,
147 timeline.ThreadDetailResultName('renderer_main','cat1') : 9.5, 146 timeline.ThreadDetailResultName('renderer_main','cat1') : 9.5,
148 timeline.ThreadDetailResultName('renderer_main','cat2') : 0.5, 147 timeline.ThreadDetailResultName('renderer_main','cat2') : 0.5,
149 timeline.ThreadDetailResultName('renderer_main','idle') : 0 148 timeline.ThreadDetailResultName('renderer_main','idle') : 0
150 } 149 }
151 for name, value in assert_results.iteritems(): 150 for name, value in assert_results.iteritems():
152 results.AssertHasPageSpecificScalarValue(name, 'ms', value) 151 results.AssertHasPageSpecificScalarValue(name, 'ms', value)
153 152
154 def testOverheadIsRemoved(self): 153 def testOverheadIsRemoved(self):
155 model = model_module.TimelineModel() 154 model = model_module.TimelineModel()
156 renderer_main = model.GetOrCreateProcess(1).GetOrCreateThread(2) 155 renderer_main = model.GetOrCreateProcess(1).GetOrCreateThread(2)
(...skipping 16 matching lines...) Expand all
173 model.FinalizeImport() 172 model.FinalizeImport()
174 173
175 # Include everything in an action-range. 174 # Include everything in an action-range.
176 metric = timeline.ThreadTimesTimelineMetric() 175 metric = timeline.ThreadTimesTimelineMetric()
177 metric._action_ranges = [self.GetActionRange(10, 30)] 176 metric._action_ranges = [self.GetActionRange(10, 30)]
178 metric.details_to_report = timeline.ReportMainThreadOnly 177 metric.details_to_report = timeline.ReportMainThreadOnly
179 results = self.GetResultsForModel(metric, model) 178 results = self.GetResultsForModel(metric, model)
180 179
181 # Test a couple specific results. 180 # Test a couple specific results.
182 assert_results = { 181 assert_results = {
183 timeline.ThreadTimeResultName('renderer_main') : 19,
184 timeline.ThreadCpuTimeResultName('renderer_main') : 9.0, 182 timeline.ThreadCpuTimeResultName('renderer_main') : 9.0,
185 } 183 }
186 for name, value in assert_results.iteritems(): 184 for name, value in assert_results.iteritems():
187 results.AssertHasPageSpecificScalarValue(name, 'ms', value) 185 results.AssertHasPageSpecificScalarValue(name, 'ms', value)
OLDNEW
« no previous file with comments | « tools/perf/metrics/timeline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698