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

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

Issue 15673005: cc: Add compositor name for easier GPU debugging. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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 | 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 import collections 4 import collections
5 5
6 from metrics import Metric 6 from metrics import Metric
7 7
8 TRACING_MODE = 'tracing-mode' 8 TRACING_MODE = 'tracing-mode'
9 TIMELINE_MODE = 'timeline-mode' 9 TIMELINE_MODE = 'timeline-mode'
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 total = sum(counter.totals) 90 total = sum(counter.totals)
91 results.Add(counter_name, 'count', total) 91 results.Add(counter_name, 'count', total)
92 results.Add(counter_name + '_avg', 'count', total / len(counter.totals)) 92 results.Add(counter_name + '_avg', 'count', total / len(counter.totals))
93 93
94 94
95 # We want to generate a consistant picture of our thread usage, despite 95 # We want to generate a consistant picture of our thread usage, despite
96 # having several process configurations (in-proc-gpu/single-proc). 96 # having several process configurations (in-proc-gpu/single-proc).
97 # Since we can't isolate renderer threads in single-process mode, we 97 # Since we can't isolate renderer threads in single-process mode, we
98 # always sum renderer-process threads' times. We also sum all io-threads 98 # always sum renderer-process threads' times. We also sum all io-threads
99 # for simplicity. 99 # for simplicity.
100 MatchBySubString = ["IOThread", "CompositorRasterWorker"]
100 TimelineThreadCategories = { 101 TimelineThreadCategories = {
101 # These are matched exactly
102 "Chrome_InProcGpuThread": "GPU", 102 "Chrome_InProcGpuThread": "GPU",
103 "CrGPUMain" : "GPU", 103 "CrGPUMain" : "GPU",
104 "AsyncTransferThread" : "GPU_transfer", 104 "AsyncTransferThread" : "GPU_transfer",
105 "CrBrowserMain" : "browser_main", 105 "CrBrowserMain" : "browser_main",
106 "Browser Compositor" : "browser_compositor", 106 "Browser Compositor" : "browser_compositor",
107 "CrRendererMain" : "renderer_main", 107 "CrRendererMain" : "renderer_main",
108 "Compositor" : "renderer_compositor", 108 "Compositor" : "renderer_compositor",
109 # These are matched by substring
110 "IOThread" : "IO", 109 "IOThread" : "IO",
111 "CompositorRasterWorker": "raster" 110 "CompositorRasterWorker": "raster"
112 } 111 }
113 112
114 def ThreadTimePercentageName(category): 113 def ThreadTimePercentageName(category):
115 return "thread_" + category + "_clock_time_percentage" 114 return "thread_" + category + "_clock_time_percentage"
116 115
117 def ThreadCPUTimePercentageName(category): 116 def ThreadCPUTimePercentageName(category):
118 return "thread_" + category + "_cpu_time_percentage" 117 return "thread_" + category + "_cpu_time_percentage"
119 118
120 class ThreadTimesTimelineMetric(TimelineMetric): 119 class ThreadTimesTimelineMetric(TimelineMetric):
121 def __init__(self): 120 def __init__(self):
122 super(ThreadTimesTimelineMetric, self).__init__(TRACING_MODE) 121 super(ThreadTimesTimelineMetric, self).__init__(TRACING_MODE)
123 122
124 def AddResults(self, tab, results): 123 def AddResults(self, tab, results):
125 # Default each category to zero for consistant results. 124 # Default each category to zero for consistant results.
126 category_clock_times = collections.defaultdict(float) 125 category_clock_times = collections.defaultdict(float)
127 category_cpu_times = collections.defaultdict(float) 126 category_cpu_times = collections.defaultdict(float)
128 127
129 for category in TimelineThreadCategories.values(): 128 for category in TimelineThreadCategories.values():
130 category_clock_times[category] = 0 129 category_clock_times[category] = 0
131 category_cpu_times[category] = 0 130 category_cpu_times[category] = 0
132 131
133 # Add up thread time for all threads we care about. 132 # Add up thread time for all threads we care about.
134 for thread in self._model.GetAllThreads(): 133 for thread in self._model.GetAllThreads():
135 # First determine if we care about this thread. 134 # First determine if we care about this thread.
136 # Check substrings first, followed by exact matches 135 # Check substrings first, followed by exact matches
137 thread_category = None 136 thread_category = None
138 for substring, category in TimelineThreadCategories.iteritems(): 137 for substring, category in TimelineThreadCategories.iteritems():
139 if substring in thread.name: 138 if substring in thread.name and substring in MatchBySubString:
140 thread_category = category 139 thread_category = category
141 if thread.name in TimelineThreadCategories: 140 if thread.name in TimelineThreadCategories:
142 thread_category = TimelineThreadCategories[thread.name] 141 thread_category = TimelineThreadCategories[thread.name]
143 if thread_category == None: 142 if thread_category == None:
144 thread_category = "other" 143 thread_category = "other"
145 144
146 # Sum top-level durations and thread-durations 145 # Sum top-level durations and thread-durations
147 have_thread_durations = True 146 have_thread_durations = True
148 for event in thread.toplevel_slices: 147 for event in thread.toplevel_slices:
149 if not event.duration: 148 if not event.duration:
(...skipping 17 matching lines...) Expand all
167 for category, category_time in category_clock_times.iteritems(): 166 for category, category_time in category_clock_times.iteritems():
168 report_name = ThreadTimePercentageName(category) 167 report_name = ThreadTimePercentageName(category)
169 time_as_percentage = (category_time / self._model.bounds.bounds) * 100 168 time_as_percentage = (category_time / self._model.bounds.bounds) * 100
170 results.Add(report_name, '%', time_as_percentage) 169 results.Add(report_name, '%', time_as_percentage)
171 170
172 # Do the same for CPU (scheduled) time. 171 # Do the same for CPU (scheduled) time.
173 for category, category_time in category_cpu_times.iteritems(): 172 for category, category_time in category_cpu_times.iteritems():
174 report_name = ThreadCPUTimePercentageName(category) 173 report_name = ThreadCPUTimePercentageName(category)
175 time_as_percentage = (category_time / self._model.bounds.bounds) * 100 174 time_as_percentage = (category_time / self._model.bounds.bounds) * 100
176 results.Add(report_name, '%', time_as_percentage) 175 results.Add(report_name, '%', time_as_percentage)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698