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

Unified Diff: tools/buildbot/perf/dashboard/ui/generic_plotter.html

Issue 20527: Sort traces on the plot so anything with a corresponding _ref trace is plotte... (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/buildbot/perf/dashboard/ui/generic_plotter.html
===================================================================
--- tools/buildbot/perf/dashboard/ui/generic_plotter.html (revision 10065)
+++ tools/buildbot/perf/dashboard/ui/generic_plotter.html (working copy)
@@ -190,11 +190,58 @@
allTraces[traceName] = 1;
}
+ // Sort trace names, putting traces with corresponding _ref lines first
+ // under the assumption that those are the most interesting ones.
+ // Returns 1 if name1 is larger, -1 if it's smaller, and 0 if they're equal.
+ // Use a closure so we have access to allTraces.
+ function trace_compare(name1, name2) {
ojan 2009/02/20 02:46:41 There's a lot of places where you do the same thin
+ function compare(x, y) {
+ return ((x < y) ? -1 : (x > y) ? 1 : 0);
+ }
+
+ // The main trace name associated with this _ref name, and whether this is
+ // in fact a _ref trace.
+ main1 = name1.substring(0, name1.length - 4);
+ main2 = name2.substring(0, name2.length - 4);
+ is_ref1 = name1.substr(-4) == "_ref" && main1 in allTraces;
+ is_ref2 = name2.substr(-4) == "_ref" && main2 in allTraces;
+
+ // Whether this trace has a corresponding _ref. If so, it's its own main
+ // trace.
+ is_main1 = name1 + "_ref" in allTraces;
+ is_main2 = name2 + "_ref" in allTraces;
+ if (is_main1)
+ main1 = name1;
+ if (is_main2)
+ main2 = name2;
+
+ // A main trace is smaller than its own _ref, compared alphabetically by
+ // main name to any other main or _ref traces, and smaller than anything
+ // else.
+ if (is_main1) {
+ if (is_ref2 && main1 == main2)
+ return -1;
+ if (is_main2 || is_ref2)
+ return compare(main1, main2);
+ return -1;
+ }
+ if (is_ref1) {
+ if (is_main2 && main1 == main2)
+ return 1;
+ if (is_main2 || is_ref2)
+ return compare(main1, main2);
+ return -1;
+ }
+ if (is_main2 || is_ref2)
+ return 1;
+ return compare(name1, name2);
+ }
+
// Build and sort a list of all the trace names we've seen.
var traceNames = [];
for (var traceName in allTraces)
traceNames.push(traceName);
- traceNames.sort();
+ traceNames.sort(trace_compare);
// Build and sort a list of revision numbers.
var revisionNumbers = [];
« 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