OLD | NEW |
---|---|
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 optparse | 5 import optparse |
6 import time | 6 import time |
7 | 7 |
8 from metrics import v8_object_stats | 8 from metrics import v8_object_stats |
9 from telemetry.page import page_measurement | 9 from telemetry.page import page_measurement |
10 from telemetry.value import scalar | 10 from telemetry.value import scalar |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 """Takes a sample and adds a result if enough time has passed.""" | 76 """Takes a sample and adds a result if enough time has passed.""" |
77 self._iterations_elapsed += 1 | 77 self._iterations_elapsed += 1 |
78 if self._iterations_elapsed % int(self.options.perf_stats_interval) == 0: | 78 if self._iterations_elapsed % int(self.options.perf_stats_interval) == 0: |
79 self._SampleStats(tab, results) | 79 self._SampleStats(tab, results) |
80 | 80 |
81 def _SampleStats(self, tab, results): | 81 def _SampleStats(self, tab, results): |
82 """Records information and add it to the results.""" | 82 """Records information and add it to the results.""" |
83 | 83 |
84 def AddPoint(trace_name, units_y, value_y, chart_name=None): | 84 def AddPoint(trace_name, units_y, value_y, chart_name=None): |
85 """Adds one data point to the results object.""" | 85 """Adds one data point to the results object.""" |
86 results.Add(trace_name + '_X', 'iterations', self._iterations_elapsed, | 86 if chart_name: |
87 data_type='unimportant', chart_name=chart_name) | 87 trace_name = '%s.%s' % (chart_name, trace_name) |
88 results.Add(trace_name + '_Y', units_y, value_y, data_type='unimportant', | 88 else: |
89 chart_name=chart_name) | 89 assert '.' not in trace_name, ( |
90 'Trace names cannot contain "." with an empty chart_name since this' | |
91 ' is used to delimit chart_name.trace_name.') | |
92 results.AddValue(scalar.ScalarValue( | |
93 results.current_page, trace_name + '_X', 'iterations', | |
94 self._iterations_elapsed)) | |
95 results.AddValue(scalar.ScalarValue( | |
96 results.current_page, trace_name + '_Y', units_y, value_y)) | |
tonyg
2014/06/11 03:39:39
Both are important=False
| |
90 | 97 |
91 # Save the value so that summary stats can be calculated. | 98 # Save the value so that summary stats can be calculated. |
92 if trace_name not in self._y_values: | 99 if trace_name not in self._y_values: |
93 self._y_values[trace_name] = { | 100 self._y_values[trace_name] = { |
94 'units': units_y, | 101 'units': units_y, |
95 'chart_name': chart_name, | 102 'chart_name': chart_name, |
96 'values': [], | 103 'values': [], |
97 } | 104 } |
98 self._y_values[trace_name]['values'].append(value_y) | 105 self._y_values[trace_name]['values'].append(value_y) |
99 | 106 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 important=False)) | 147 important=False)) |
141 | 148 |
142 # Add summary stats which could be monitored for anomalies. | 149 # Add summary stats which could be monitored for anomalies. |
143 for trace_name in self._y_values: | 150 for trace_name in self._y_values: |
144 units = self._y_values[trace_name]['units'] | 151 units = self._y_values[trace_name]['units'] |
145 chart_name = self._y_values[trace_name]['chart_name'] | 152 chart_name = self._y_values[trace_name]['chart_name'] |
146 values = self._y_values[trace_name]['values'] | 153 values = self._y_values[trace_name]['values'] |
147 value_name = '%s.%s_max' % (chart_name, trace_name) | 154 value_name = '%s.%s_max' % (chart_name, trace_name) |
148 results.AddSummaryValue( | 155 results.AddSummaryValue( |
149 scalar.ScalarValue(None, value_name, units, max(values))) | 156 scalar.ScalarValue(None, value_name, units, max(values))) |
OLD | NEW |