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

Side by Side Diff: tools/perf/measurements/v8_gc_times.py

Issue 1151933005: Make sure that tracing is always cleaned up for v8_gc_times page_test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittest Created 5 years, 6 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 | « no previous file | tools/perf/measurements/v8_gc_times_unittest.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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 from telemetry.core.platform import tracing_category_filter 5 from telemetry.core.platform import tracing_category_filter
6 from telemetry.core.platform import tracing_options 6 from telemetry.core.platform import tracing_options
7 from telemetry.page import page_test 7 from telemetry.page import page_test
8 from telemetry.timeline.model import TimelineModel 8 from telemetry.timeline.model import TimelineModel
9 from telemetry.util import statistics 9 from telemetry.util import statistics
10 from telemetry.value import scalar 10 from telemetry.value import scalar
(...skipping 24 matching lines...) Expand all
35 35
36 tab.browser.platform.tracing_controller.Start( 36 tab.browser.platform.tracing_controller.Start(
37 options, category_filter, self._TIME_OUT_IN_SECONDS) 37 options, category_filter, self._TIME_OUT_IN_SECONDS)
38 38
39 def ValidateAndMeasurePage(self, page, tab, results): 39 def ValidateAndMeasurePage(self, page, tab, results):
40 trace_data = tab.browser.platform.tracing_controller.Stop() 40 trace_data = tab.browser.platform.tracing_controller.Stop()
41 timeline_model = TimelineModel(trace_data) 41 timeline_model = TimelineModel(trace_data)
42 renderer_process = timeline_model.GetRendererProcessFromTabId(tab.id) 42 renderer_process = timeline_model.GetRendererProcessFromTabId(tab.id)
43 self._AddV8MetricsToResults(renderer_process, results) 43 self._AddV8MetricsToResults(renderer_process, results)
44 44
45 def CleanUpAfterPage(self, page, tab):
46 if tab.browser.platform.tracing_controller.is_tracing_running:
47 tab.browser.platform.tracing_controller.Stop()
48
45 def _AddV8MetricsToResults(self, process, results): 49 def _AddV8MetricsToResults(self, process, results):
46 if process is None: 50 if process is None:
47 return 51 return
48 52
49 for thread in process.threads.values(): 53 for thread in process.threads.values():
50 if thread.name != self._RENDERER_MAIN_THREAD: 54 if thread.name != self._RENDERER_MAIN_THREAD:
51 continue 55 continue
52 56
53 self._AddV8EventStatsToResults(thread, results) 57 self._AddV8EventStatsToResults(thread, results)
54 self._AddCpuTimeStatsToResults(thread, results) 58 self._AddCpuTimeStatsToResults(thread, results)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 self.idle_task_overrun_duration = 0.0 187 self.idle_task_overrun_duration = 0.0
184 188
185 @property 189 @property
186 def thread_duration_outside_idle(self): 190 def thread_duration_outside_idle(self):
187 return self.thread_duration - self.thread_duration_inside_idle 191 return self.thread_duration - self.thread_duration_inside_idle
188 192
189 @property 193 @property
190 def percentage_thread_duration_during_idle(self): 194 def percentage_thread_duration_during_idle(self):
191 return statistics.DivideIfPossibleOrZero( 195 return statistics.DivideIfPossibleOrZero(
192 100 * self.thread_duration_inside_idle, self.thread_duration) 196 100 * self.thread_duration_inside_idle, self.thread_duration)
OLDNEW
« no previous file with comments | « no previous file | tools/perf/measurements/v8_gc_times_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698