OLD | NEW |
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 '%s_outside_idle' % v8_event_stat.result_name, 'ms', | 102 '%s_outside_idle' % v8_event_stat.result_name, 'ms', |
103 v8_event_stat.thread_duration_outside_idle, | 103 v8_event_stat.thread_duration_outside_idle, |
104 ('Total thread duration spent in %s outside of idle tasks' % | 104 ('Total thread duration spent in %s outside of idle tasks' % |
105 v8_event_stat.result_description))) | 105 v8_event_stat.result_description))) |
106 results.AddValue(scalar.ScalarValue(results.current_page, | 106 results.AddValue(scalar.ScalarValue(results.current_page, |
107 '%s_idle_deadline_overrun' % v8_event_stat.result_name, 'ms', | 107 '%s_idle_deadline_overrun' % v8_event_stat.result_name, 'ms', |
108 v8_event_stat.idle_task_overrun_duration, | 108 v8_event_stat.idle_task_overrun_duration, |
109 ('Total idle task deadline overrun for %s idle tasks' | 109 ('Total idle task deadline overrun for %s idle tasks' |
110 % v8_event_stat.result_description))) | 110 % v8_event_stat.result_description))) |
111 results.AddValue(scalar.ScalarValue(results.current_page, | 111 results.AddValue(scalar.ScalarValue(results.current_page, |
112 '%s_percentage_idle' % v8_event_stat.result_name, '%', | 112 '%s_percentage_idle' % v8_event_stat.result_name, 'idle%', |
113 v8_event_stat.percentage_thread_duration_during_idle, | 113 v8_event_stat.percentage_thread_duration_during_idle, |
114 ('Percentage of %s spent in idle time' % | 114 ('Percentage of %s spent in idle time' % |
115 v8_event_stat.result_description))) | 115 v8_event_stat.result_description))) |
116 | 116 |
117 # Add total metrics. | 117 # Add total metrics. |
118 gc_total = sum(x.thread_duration for x in self._v8_event_stats) | 118 gc_total = sum(x.thread_duration for x in self._v8_event_stats) |
119 gc_total_outside_idle = sum( | 119 gc_total_outside_idle = sum( |
120 x.thread_duration_outside_idle for x in self._v8_event_stats) | 120 x.thread_duration_outside_idle for x in self._v8_event_stats) |
121 gc_total_idle_deadline_overrun = sum( | 121 gc_total_idle_deadline_overrun = sum( |
122 x.idle_task_overrun_duration for x in self._v8_event_stats) | 122 x.idle_task_overrun_duration for x in self._v8_event_stats) |
123 gc_total_percentage_idle = statistics.DivideIfPossibleOrZero( | 123 gc_total_percentage_idle = statistics.DivideIfPossibleOrZero( |
124 100 * (gc_total - gc_total_outside_idle), gc_total) | 124 100 * (gc_total - gc_total_outside_idle), gc_total) |
125 | 125 |
126 results.AddValue(scalar.ScalarValue(results.current_page, | 126 results.AddValue(scalar.ScalarValue(results.current_page, |
127 'v8_gc_total', 'ms', gc_total, | 127 'v8_gc_total', 'ms', gc_total, |
128 'Total thread duration of all garbage collection events')) | 128 'Total thread duration of all garbage collection events')) |
129 results.AddValue(scalar.ScalarValue(results.current_page, | 129 results.AddValue(scalar.ScalarValue(results.current_page, |
130 'v8_gc_total_outside_idle', 'ms', gc_total_outside_idle, | 130 'v8_gc_total_outside_idle', 'ms', gc_total_outside_idle, |
131 'Total thread duration of all garbage collection events outside of ' | 131 'Total thread duration of all garbage collection events outside of ' |
132 'idle tasks')) | 132 'idle tasks')) |
133 results.AddValue(scalar.ScalarValue(results.current_page, | 133 results.AddValue(scalar.ScalarValue(results.current_page, |
134 'v8_gc_total_idle_deadline_overrun', 'ms', | 134 'v8_gc_total_idle_deadline_overrun', 'ms', |
135 gc_total_idle_deadline_overrun, | 135 gc_total_idle_deadline_overrun, |
136 'Total idle task deadline overrun for all idle tasks garbage ' | 136 'Total idle task deadline overrun for all idle tasks garbage ' |
137 'collection events')) | 137 'collection events')) |
138 results.AddValue(scalar.ScalarValue(results.current_page, | 138 results.AddValue(scalar.ScalarValue(results.current_page, |
139 'v8_gc_total_percentage_idle', '%', gc_total_percentage_idle, | 139 'v8_gc_total_percentage_idle', 'idle%', gc_total_percentage_idle, |
140 'Percentage of the thread duration of all garbage collection events ' | 140 'Percentage of the thread duration of all garbage collection events ' |
141 'spent inside of idle tasks')) | 141 'spent inside of idle tasks')) |
142 | 142 |
143 def _AddCpuTimeStatsToResults(self, thread, results): | 143 def _AddCpuTimeStatsToResults(self, thread, results): |
144 if thread.toplevel_slices: | 144 if thread.toplevel_slices: |
145 start_time = min(s.start for s in thread.toplevel_slices) | 145 start_time = min(s.start for s in thread.toplevel_slices) |
146 end_time = max(s.end for s in thread.toplevel_slices) | 146 end_time = max(s.end for s in thread.toplevel_slices) |
147 duration = end_time - start_time | 147 duration = end_time - start_time |
148 cpu_time = sum(s.thread_duration for s in thread.toplevel_slices) | 148 cpu_time = sum(s.thread_duration for s in thread.toplevel_slices) |
149 else: | 149 else: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 self.idle_task_overrun_duration = 0.0 | 182 self.idle_task_overrun_duration = 0.0 |
183 | 183 |
184 @property | 184 @property |
185 def thread_duration_outside_idle(self): | 185 def thread_duration_outside_idle(self): |
186 return self.thread_duration - self.thread_duration_inside_idle | 186 return self.thread_duration - self.thread_duration_inside_idle |
187 | 187 |
188 @property | 188 @property |
189 def percentage_thread_duration_during_idle(self): | 189 def percentage_thread_duration_during_idle(self): |
190 return statistics.DivideIfPossibleOrZero( | 190 return statistics.DivideIfPossibleOrZero( |
191 100 * self.thread_duration_inside_idle, self.thread_duration) | 191 100 * self.thread_duration_inside_idle, self.thread_duration) |
OLD | NEW |