Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Defines various log processors used by buildbot steps. | 6 """Defines various log processors used by buildbot steps. |
| 7 | 7 |
| 8 Current approach is to set an instance of log processor in | 8 Current approach is to set an instance of log processor in |
| 9 the ProcessLogTestStep implementation and it will call process() | 9 the ProcessLogTestStep implementation and it will call process() |
| 10 method upon completion with full data from process stdio. | 10 method upon completion with full data from process stdio. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 if output_dir is None: | 112 if output_dir is None: |
| 113 output_dir = os.getcwd() | 113 output_dir = os.getcwd() |
| 114 elif output_dir.startswith('~'): | 114 elif output_dir.startswith('~'): |
| 115 output_dir = os.path.expanduser(output_dir) | 115 output_dir = os.path.expanduser(output_dir) |
| 116 self._output_dir = output_dir | 116 self._output_dir = output_dir |
| 117 self._matches = {} | 117 self._matches = {} |
| 118 | 118 |
| 119 # Performance regression/speedup alerts. | 119 # Performance regression/speedup alerts. |
| 120 self._perf_id = perf_id | 120 self._perf_id = perf_id |
| 121 self._perf_name = perf_name | 121 self._perf_name = perf_name |
| 122 self._perf_filename = os.path.join(PERF_EXPECTATIONS_PATH, | 122 self._perf_filename = None |
| 123 self._perf_id + ".json") | |
| 124 self._actual_performance = {} | 123 self._actual_performance = {} |
| 125 self._expected_performance = {} | 124 self._expected_performance = {} |
| 126 self._perf_regress = [] | 125 self._perf_regress = [] |
| 127 self._var_regress = [] | 126 self._var_regress = [] |
| 128 self._perf_improve = [] | 127 self._perf_improve = [] |
| 129 self._var_improve = [] | 128 self._var_improve = [] |
| 130 | 129 |
| 131 # The revision isn't known until the Process() call. | 130 # The revision isn't known until the Process() call. |
| 132 self._revision = -1 | 131 self._revision = -1 |
| 133 | 132 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 145 if not m: | 144 if not m: |
| 146 continue | 145 continue |
| 147 | 146 |
| 148 graph_name = m.group(1) | 147 graph_name = m.group(1) |
| 149 result_type = m.group(2) | 148 result_type = m.group(2) |
| 150 | 149 |
| 151 self._expected_performance.setdefault(graph_name, {}) | 150 self._expected_performance.setdefault(graph_name, {}) |
| 152 self._expected_performance[graph_name][result_type] = perf_data[perf_key] | 151 self._expected_performance[graph_name][result_type] = perf_data[perf_key] |
| 153 | 152 |
| 154 def LoadPerformanceExpectations(self): | 153 def LoadPerformanceExpectations(self): |
| 155 self._expected = {} | 154 if not self._perf_id: |
| 155 logging.error("not loading perf expectations: perf_id missing") | |
|
Nicolas Sylvain
2009/09/15 21:47:47
is this really an error?
| |
| 156 return | |
| 157 self._perf_filename = os.path.join(PERF_EXPECTATIONS_PATH, | |
| 158 self._perf_id + ".json") | |
| 156 try: | 159 try: |
| 157 perf_file = open(self._perf_filename, 'r') | 160 perf_file = open(self._perf_filename, 'r') |
| 158 except IOError, e: | 161 except IOError, e: |
| 159 raise | 162 raise |
| 160 | 163 |
| 161 perf_data = [] | 164 perf_data = [] |
| 162 if perf_file: | 165 if perf_file: |
| 163 try: | 166 try: |
| 164 perf_data = simplejson.load(perf_file) | 167 perf_data = simplejson.load(perf_file) |
| 165 except ValueError: | 168 except ValueError: |
| 166 perf_file.seek(0) | 169 perf_file.seek(0) |
| 167 logging.error("Error parsing %s: '%s'" % (PERF_EXPECTATIONS, | 170 logging.error("Error parsing %s: '%s'" % (PERF_EXPECTATIONS, |
| 168 perf_file.read().strip())) | 171 perf_file.read().strip())) |
| 169 perf_file.close() | 172 perf_file.close() |
| 170 | 173 |
| 171 # Find this perf/test entry | 174 # Find this perf/test entry |
| 172 if perf_data and perf_data.has_key('load') and perf_data['load']: | 175 if perf_data and perf_data.has_key('load') and perf_data['load']: |
| 173 self.LoadPerformanceExpectationsGroup(perf_data) | 176 self.LoadPerformanceExpectationsGroup(perf_data) |
| 174 else: | 177 else: |
| 175 logging.error("not loading perf expectations, perf_data is disabled") | 178 logging.error("not loading perf expectations: perf_data is disabled") |
| 176 | 179 |
| 177 def TrackActualPerformance(self, graph_name=None, result_type=None, | 180 def TrackActualPerformance(self, graph_name=None, result_type=None, |
| 178 value=None, stddev=None): | 181 value=None, stddev=None): |
| 179 """Set actual performance data when we come across useful values. | 182 """Set actual performance data when we come across useful values. |
| 180 | 183 |
| 181 result_type will be of the form "RESULTTYPE" or "RESULTTYPE_ref". | 184 result_type will be of the form "RESULTTYPE" or "RESULTTYPE_ref". |
| 182 A trace with _ref in its name refers to a reference build. | 185 A trace with _ref in its name refers to a reference build. |
| 183 | 186 |
| 184 Common result types for page cyclers: t, vm_rss_f_r, IO_b_b, etc. | 187 Common result types for page cyclers: t, vm_rss_f_r, IO_b_b, etc. |
| 185 A test's result types vary between test types. Currently, a test | 188 A test's result types vary between test types. Currently, a test |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 790 FormatFloat(mean), | 793 FormatFloat(mean), |
| 791 FormatFloat(stddev), | 794 FormatFloat(stddev), |
| 792 self._JoinWithSpacesAndNewLine(times))) | 795 self._JoinWithSpacesAndNewLine(times))) |
| 793 | 796 |
| 794 filename = os.path.join(self._output_dir, | 797 filename = os.path.join(self._output_dir, |
| 795 '%s_%s.dat' % (self._revision, trace_name)) | 798 '%s_%s.dat' % (self._revision, trace_name)) |
| 796 file = open(filename, 'w') | 799 file = open(filename, 'w') |
| 797 file.write(''.join(file_data)) | 800 file.write(''.join(file_data)) |
| 798 file.close() | 801 file.close() |
| 799 os.chmod(filename, READABLE_FILE_PERMISSIONS) | 802 os.chmod(filename, READABLE_FILE_PERMISSIONS) |
| OLD | NEW |