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

Side by Side Diff: tools/buildbot/perf/dashboard/ui/generic_plotter.html

Issue 28034: Move the trace sorting from the JS up to the Python, matching what's done for... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/buildbot/scripts/master/log_parser/process_log.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 2
3 <!-- 3 <!--
4 Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 4 Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
5 Use of this source code is governed by a BSD-style license that can be 5 Use of this source code is governed by a BSD-style license that can be
6 found in the LICENSE file. 6 found in the LICENSE file.
7 --> 7 -->
8 8
9 <!-- 9 <!--
10 A brief note on terminology as used here: a "graph" is a plotted screenful 10 A brief note on terminology as used here: a "graph" is a plotted screenful
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 var row = jsonToJs(rows[i]); 183 var row = jsonToJs(rows[i]);
184 var traces = row['traces']; 184 var traces = row['traces'];
185 var revision = parseInt(row['rev']); 185 var revision = parseInt(row['rev']);
186 graphData[revision] = traces; 186 graphData[revision] = traces;
187 187
188 // Collect unique trace names. 188 // Collect unique trace names.
189 for (var traceName in traces) 189 for (var traceName in traces)
190 allTraces[traceName] = 1; 190 allTraces[traceName] = 1;
191 } 191 }
192 192
193 // Sort trace names, putting traces with corresponding _ref lines first 193 // Build a list of all the trace names we've seen, in the order in which
194 // under the assumption that those are the most interesting ones. 194 // they appear in the data file. Although JS objects are not required by
195 // Returns 1 if name1 is larger, -1 if it's smaller, and 0 if they're equal. 195 // the spec to iterate their properties in order, in practice they do,
196 // Use a closure so we have access to allTraces. 196 // because it causes compatibility problems otherwise.
197 function trace_compare(name1, name2) {
198 function compare(x, y) {
199 return ((x < y) ? -1 : (x > y) ? 1 : 0);
200 }
201
202 // The main trace name associated with this _ref name, and whether this is
203 // in fact a _ref trace.
204 main1 = name1.substring(0, name1.length - 4);
205 main2 = name2.substring(0, name2.length - 4);
206 is_ref1 = name1.substr(-4) == "_ref" && main1 in allTraces;
207 is_ref2 = name2.substr(-4) == "_ref" && main2 in allTraces;
208
209 // Whether this trace has a corresponding _ref. If so, it's its own main
210 // trace.
211 is_main1 = name1 + "_ref" in allTraces;
212 is_main2 = name2 + "_ref" in allTraces;
213 if (is_main1)
214 main1 = name1;
215 if (is_main2)
216 main2 = name2;
217
218 // A main trace is smaller than its own _ref, compared alphabetically by
219 // main name to any other main or _ref traces, and smaller than anything
220 // else.
221 if (is_main1) {
222 if (is_ref2 && main1 == main2)
223 return -1;
224 if (is_main2 || is_ref2)
225 return compare(main1, main2);
226 return -1;
227 }
228 if (is_ref1) {
229 if (is_main2 && main1 == main2)
230 return 1;
231 if (is_main2 || is_ref2)
232 return compare(main1, main2);
233 return -1;
234 }
235 if (is_main2 || is_ref2)
236 return 1;
237 return compare(name1, name2);
238 }
239
240 // Build and sort a list of all the trace names we've seen.
241 var traceNames = []; 197 var traceNames = [];
242 for (var traceName in allTraces) 198 for (var traceName in allTraces)
243 traceNames.push(traceName); 199 traceNames.push(traceName);
244 traceNames.sort(trace_compare);
245 200
246 // Build and numerically sort a list of revision numbers. 201 // Build and numerically sort a list of revision numbers.
247 var revisionNumbers = []; 202 var revisionNumbers = [];
248 for (var rev in graphData) 203 for (var rev in graphData)
249 revisionNumbers.push(rev); 204 revisionNumbers.push(rev);
250 revisionNumbers.sort( 205 revisionNumbers.sort(
251 function(a, b) { return parseInt(a, 10) - parseInt(b, 10) }); 206 function(a, b) { return parseInt(a, 10) - parseInt(b, 10) });
252 207
253 // Build separate ordered lists of trace data. 208 // Build separate ordered lists of trace data.
254 var traceData = {}; 209 var traceData = {};
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 details.style.display = "none"; 352 details.style.display = "none";
398 header_text.style.display = "none"; 353 header_text.style.display = "none";
399 explain.style.display = "none"; 354 explain.style.display = "none";
400 selection.style.display = "none"; 355 selection.style.display = "none";
401 } else { 356 } else {
402 document.getElementById("header_lookout").style.display = "none"; 357 document.getElementById("header_lookout").style.display = "none";
403 } 358 }
404 </script> 359 </script>
405 </body> 360 </body>
406 </html> 361 </html>
OLDNEW
« no previous file with comments | « no previous file | tools/buildbot/scripts/master/log_parser/process_log.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698