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

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

Issue 1124033004: [Telemetry] Kill PageTest.DidRunActions hook. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix task_execution_time. Thanks unittest! Created 5 years, 7 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 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 for category in self._CATEGORIES: 47 for category in self._CATEGORIES:
48 category_filter.AddIncludedCategory(category) 48 category_filter.AddIncludedCategory(category)
49 49
50 options = tracing_options.TracingOptions() 50 options = tracing_options.TracingOptions()
51 options.enable_chrome_trace = True 51 options.enable_chrome_trace = True
52 52
53 tab.browser.platform.tracing_controller.Start( 53 tab.browser.platform.tracing_controller.Start(
54 options, category_filter, self._TIME_OUT_IN_SECONDS) 54 options, category_filter, self._TIME_OUT_IN_SECONDS)
55 55
56 def DidRunActions(self, page, tab): 56 def ValidateAndMeasurePage(self, page, tab, results):
57 trace_data = tab.browser.platform.tracing_controller.Stop() 57 trace_data = tab.browser.platform.tracing_controller.Stop()
58 timeline_model = TimelineModel(trace_data) 58 timeline_model = TimelineModel(trace_data)
59 59
60 self._renderer_process = timeline_model.GetRendererProcessFromTabId(tab.id) 60 self._renderer_process = timeline_model.GetRendererProcessFromTabId(tab.id)
61 self._browser_process = timeline_model.browser_process 61 self._browser_process = timeline_model.browser_process
62 self._AddResults(results)
62 63
63 def ValidateAndMeasurePage(self, page, tab, results): 64 def _AddResults(self, results):
64 self._results = results 65 self._results = results
65 66
66 for thread in self._BROWSER_THREADS: 67 for thread in self._BROWSER_THREADS:
67 self._AddTasksFromThreadToResults(self._browser_process, thread) 68 self._AddTasksFromThreadToResults(self._browser_process, thread)
68 69
69 for thread in self._RENDERER_THREADS: 70 for thread in self._RENDERER_THREADS:
70 self._AddTasksFromThreadToResults(self._renderer_process, thread) 71 self._AddTasksFromThreadToResults(self._renderer_process, thread)
71 72
72 def _AddTasksFromThreadToResults(self, process, thread_name): 73 def _AddTasksFromThreadToResults(self, process, thread_name):
73 if process is None: 74 if process is None:
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 def AddTask(self, name, duration): 220 def AddTask(self, name, duration):
220 if name in self.tasks: 221 if name in self.tasks:
221 # section_tasks already contains an entry for this (e.g. from an earlier 222 # section_tasks already contains an entry for this (e.g. from an earlier
222 # slice), add the new duration so we can calculate a median value later. 223 # slice), add the new duration so we can calculate a median value later.
223 self.tasks[name].Update(duration) 224 self.tasks[name].Update(duration)
224 else: 225 else:
225 # This is a new task so create a new entry for it. 226 # This is a new task so create a new entry for it.
226 self.tasks[name] = NameAndDurations(name, duration) 227 self.tasks[name] = NameAndDurations(name, duration)
227 # Accumulate total duration for all tasks in this section. 228 # Accumulate total duration for all tasks in this section.
228 self.total_duration += duration 229 self.total_duration += duration
OLDNEW
« no previous file with comments | « tools/perf/measurements/oilpan_gc_times_unittest.py ('k') | tools/perf/measurements/task_execution_time_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698