summaryrefslogtreecommitdiffstats
path: root/web/analysis/rankings.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/analysis/rankings.js')
-rw-r--r--web/analysis/rankings.js400
1 files changed, 0 insertions, 400 deletions
diff --git a/web/analysis/rankings.js b/web/analysis/rankings.js
deleted file mode 100644
index 890165e..0000000
--- a/web/analysis/rankings.js
+++ /dev/null
@@ -1,400 +0,0 @@
-// --- BEGIN Global variables -----------------------------------
-var maxsize = null; // Maximum number of benchmarks in a ranking
-// --- END Global variables -------------------------------------
-
-function selectRankingTable() {
- var val = $("#select_rankingTable").attr("value");
- var types = ["qs", "lcssr", "lcssi", "lcss1r", "lcss1i"];
- for (index in types) {
- var type = types[index];
- $("#div_rankingTable_" + type).css(
- "display", (val == type) ? "block" : "none");
- }
-
- var currTable = "#rankingTable_" + val;
-
- // Update "number of rows" label:
- var nrows = $(currTable).find("tr").length - 1;
- $("#rankingTable_nrows").text(
- nrows + ((nrows == 1) ? " row" : " rows") +
- " (limit: " + (maxsize < 0 ? "unlimited" : maxsize) + ")");
-
- // Update plot to reflect selection of current table:
- var cb = $(currTable).find("input[name='currSelector'][checked='true']");
- if (cb.length == 0) {
- if (plot)
- clearPlot();
- } else {
- cb.trigger("click");
- cb.attr("checked", true);
- }
-}
-
-
-// Submits a note for a given time series.
-function submitTimeSeriesNote(
- textInput, tableSel, database, host, platform, branch, benchmark, metric) {
-
- updateStatus("updating note ...", true);
-
- // Synchronize other ranking tables:
- // ### WORK IN PROGRESS:
- // var types = ["qs", "lcssr", "lcssi", "lcss1r", "lcss1i"];
- // for (var i in types) {
- // var tsel = "#rankingTable_" + types[i];
- // if (tsel == tableSel)
- // continue;
- // alert("i: " + i + ", tsel: " + tsel);
- // var tr = $(tsel + " tr").find(
- // "td:nth-child(6):contains(" + metric + ")").find(
- // "td:nth-child(7):contains(" + benchmark + ")");
- // alert("tr.length: " + tr.length);
- // }
-
-
- // Update database:
- query = "?db=" + database +
- "&cmd=settimeseriesnote" +
- "&host=" + encodeURIComponent(host) +
- "&platform=" + encodeURIComponent(platform) +
- "&branch=" + encodeURIComponent(branch) +
- "&benchmark=" + encodeURIComponent(benchmark) +
- "&metric=" + encodeURIComponent(metric) +
- "&note=" + encodeURIComponent(textInput.value.substring(0, 256));
-
- url = "http://" + location.host + "/cgi-bin/getstatswrapper" + query;
- //alert("url: >" + url + "<");
-
- $.ajax({
- url: url,
- type: "GET",
- dataType: "json",
-
- success: function(data, textStatus, request) {
- if (request.readyState == 4) {
- if (request.status == 200) {
-
- if (data.error != null) {
- updateStatus(
- "updating note ... failed: " +
- data.error, false);
- return
- }
-
- updateStatus("updating note ... done", false);
- updateStatus("", false);
- }
- }
- },
-
- error: function(request, textStatus, errorThrown) {
- descr = errorThrown;
- if (errorThrown == null) {
- descr = "undefined error - is the server down?";
- }
- updateStatus("updating note ... error: " + descr, false);
- }
-
- // complete: function(request, textStatus) {
- // alert("complete; request.status: " + request.status)
- // }
-
- });
-}
-
-// Submits a note for a given snapshot in a given time series.
-function submitSnapshotNote(textInput) {
- // 2 B DONE!
-}
-
-function populateRankingTable(
- tableSel, rankings, database, host, platform, branch, sha11, sha12,
- difftol, durtolmin, durtolmax, bmarkId2Name, metricId2Name) {
-
- // Remove all rows below the header ...
- $(tableSel + " tr:gt(0)").remove();
-
- var currTime = dateToTimestamp(currDate);
-
- var html = "";
- for (var i = 0; i < rankings.length; ++i) {
-
- var row = rankings[i];
- var bmarkId = row[0];
- var metricId = row[1];
- var context1Id = row[2]; // unused?
- var pos = row[3];
- var val = row[4];
- var lcTimestamp = row[5];
- var note = row[6];
- var hasPrevDelta = (row.length > 7);
- var prevDelta = hasPrevDelta ? row[7] : null;
-
- benchmark = bmarkId2Name[bmarkId];
- metric = metricId2Name[metricId];
-
- html += "<tr>"
-
- html += "<td><input type=\"radio\" name=\"currSelector\" onclick=\"" +
- "clickBMRadioButton(this, '" + tableSel + "', '" +
- database + "', '" + host + "', '" +
- platform + "', '" + branch + "', '" +
- sha11 + "', '" + sha12 + "', '" +
- benchmark + "', '" + metric + "', " +
- difftol + ", " + durtolmin + ", " + durtolmax +
- ")\"></td>";
-
- if (pos >= 0) {
- html += "<td style=\"text-align:right\">" + pos + "</td>";
- } else {
- html += "<td style=\"text-align:center; color:red\">n/a</td>";
- }
- if (hasPrevDelta) {
- html += "<td style=\"text-align:right\">" + prevDelta + "</td>";
- } else {
- html += "<td style=\"text-align:center; color:red\">n/a</td>";
- }
- if (val >= 0) {
- html += "<td style=\"text-align:right\">" + val + "</td>";
- } else {
- html += "<td style=\"text-align:center; color:red\">n/a</td>";
- }
-
- if (lcTimestamp >= 0) {
- var secsAgo = currTime - lcTimestamp;
- lcDaysAgo = secsToDays(secsAgo);
- html += "<td style=\"background-color:" + ageColor(secsAgo) +
- "; text-align:right\">" + lcDaysAgo + "</td>";
- } else {
- html += "<td style=\"text-align:center; color:red\">n/a</td>";
- }
-
- html += "<td class=\"metric\">" + metric + "</td>";
- html += "<td class=\"benchmark\" style=\"width:50%\">" +
- benchmark + "</td>";
-
- html += "<td style=\"width:50%\">" +
- "<input type=\"text\" style=\"width:100%\" " +
- "value=\"" + note + "\" " +
- "onchange=\"submitTimeSeriesNote(this, '" +
- tableSel + "', '" +
- database + "', '" + host + "', '" +
- platform + "', '" + branch + "', '" +
- benchmark + "', '" + metric + "')\" /></td>";
-
- html += "</tr>";
- }
-
- $(tableSel + " > tbody:last").append(html);
- $(tableSel).trigger("update");
- if (html != "") // hm ... why is this test necessary?
- $(tableSel).trigger("appendCache");
-
- // var sorting = [[11,1],[0,0]];
- //$("table").trigger("sorton",[sorting]);
-}
-
-function fetchRankings(
- database, host, platform, branch, sha1, testCaseFilter, maxsize) {
- updateStatus("fetching rankings ...", true);
-
- query = "?db=" + database +
- "&cmd=rankings" +
- "&host=" + encodeURIComponent(host) +
- "&platform=" + encodeURIComponent(platform) +
- "&branch=" + encodeURIComponent(branch) +
- "&sha1=" + sha1 +
- "&maxsize=" + maxsize;
- if (testCaseFilter != "")
- query += "&testcasefilter=" + encodeURIComponent(testCaseFilter);
-
- url = "http://" + location.host + "/cgi-bin/getstatswrapper" + query;
- //alert("url: >" + url + "<");
-
- $.ajax({
- url: url,
- type: "GET",
- dataType: "json",
-
- success: function(data, textStatus, request) {
- if (request.readyState == 4) {
- if (request.status == 200) {
-
- if (data.error != null) {
- updateStatus(
- "fetching rankings ... failed: " +
- data.error, false);
- return
- }
-
- updateStatus("fetching rankings ... done", false);
- updateStatus("", false);
-
- var sha11 = data.snapshots[0][0];
- var sha12 = data.snapshots[data.snapshots.length - 1][0];
-
- // ### The tolerance values should automatically be
- // set to those hardcoded in finalizeresults.py!
- // ... 2 B DONE!
- difftol = 1.1;
- durtolmin = 3;
- durtolmax = 30;
-
- // Show context ...
- $("#main_context_database").text(data.database);
- $("#main_context_host").text(data.host);
- $("#main_context_platform").text(data.platform);
- $("#main_context_branch").text(data.branch);
- $("#main_context_sha11").text(sha11);
- $("#main_context_sha12").text(sha12);
- $("#main_context_difftol").text(difftol);
- $("#main_context_durtolmin").text(durtolmin);
- $("#main_context_durtolmax").text(durtolmax);
-
- setSnapshots(data.snapshots);
-
-
- var bmarkId2Name = [];
- for (var i = 0; i < data.benchmarks.length; ++i) {
- bmarkInfo = data.benchmarks[i];
- bmarkId2Name[bmarkInfo[0]] = bmarkInfo[1];
- }
-
- var metricId2Name = [];
- for (var i = 0; i < data.metrics.length; ++i) {
- metricInfo = data.metrics[i];
- metricId2Name[metricInfo[0]] = metricInfo[1];
- }
-
- var rankings = {
- "qs": data.rankings.qs,
- "lcssr": data.rankings.lcssr,
- "lcssi": data.rankings.lcssi,
- "lcss1r": data.rankings.lcss1r,
- "lcss1i": data.rankings.lcss1i
- };
- for (key in rankings)
- populateRankingTable(
- "#rankingTable_" + key, rankings[key],
- data.database, data.host, data.platform,
- data.branch, sha11, sha12, difftol, durtolmin,
- durtolmax, bmarkId2Name, metricId2Name);
-
-
- // Initially show the QS statistic table:
- $("#select_rankingTable").attr("value", "qs");
- selectRankingTable();
-
- $("#div_tsbm_border").css("display", "block");
- $("#div_tsbm").css("display", "block");
- $("#div_perBenchmarkStats").css("display", "block");
-
- $("#div_context").css("display", "block");
- $("#div_rankings").css("display", "block");
-
- clearPlot();
- }
- }
- },
-
- error: function(request, textStatus, errorThrown) {
- descr = errorThrown;
- if (errorThrown == null) {
- descr = "undefined error - is the server down?";
- }
- updateStatus("fetching rankings ... error: " + descr, false);
- }
-
- // complete: function(request, textStatus) {
- // alert("complete; request.status: " + request.status)
- // }
-
- });
-}
-
-
-function initRankingTable(tableSel) {
-
- $(tableSel).tablesorter({
- headers: {
- 0: { sorter: false }, // checkbox
- 1: { sorter: "mixed_numeric_asc_before_missing" }, // Pos
- 2: { sorter: "mixed_numeric_desc_before_missing" }, // Delta
- 3: { sorter: false }, // Score (ordered as pos!)
- 4: { sorter: "mixed_numeric_asc_before_missing" }, // LCDA
- 5: { }, // Metric
- 6: { } // Benchmark
- }
- });
-
- // Note: The nth-child selector below uses 1-based indexing!
- setTooltip( // Position
- $(tableSel).find("th:nth-child(2)"),
- "Ranking position. The lower the number, the stronger the " +
- "benchmark deserves attention.");
- setTooltip( // Delta
- $(tableSel).find("th:nth-child(3)"),
- "The previous ranking position minus the current one. " +
- "The higher the number, the faster the benchmark rises " +
- "in the ranking.");
- setTooltip( // Score
- $(tableSel).find("th:nth-child(4)"),
- "The value of the current ranking statistic.");
- setTooltip( // LCDA
- $(tableSel).find("th:nth-child(5)"), tooltipText_lcda_nodist());
-}
-
-$(document).ready(function() {
-
- initTablesorter();
- initTSBMBody();
-
- initRankingTable("#rankingTable_qs");
- initRankingTable("#rankingTable_lcssr");
- initRankingTable("#rankingTable_lcssi");
- initRankingTable("#rankingTable_lcss1r");
- initRankingTable("#rankingTable_lcss1i");
-
- var args = queryStringArgs();
-
- database = extractArg(args, "db");
- if (database == "") {
- alert("ERROR: invalid query string (empty database)");
- return;
- }
-
- host = extractArg(args, "host");
- if (host == "") {
- alert("ERROR: invalid query string (empty host)");
- return;
- }
- platform = extractArg(args, "platform");
- if (platform == "") {
- alert("ERROR: invalid query string (empty platform)");
- return;
- }
- branch = extractArg(args, "branch");
- if (branch == "") {
- alert("ERROR: invalid query string (empty branch)");
- return;
- }
- sha1 = extractArg(args, "sha1");
- if (sha1 == "") {
- alert("ERROR: invalid query string (empty sha1)");
- return;
- }
- maxsize = extractArg(args, "maxsize");
- if (maxsize == "") {
- alert("ERROR: invalid query string (empty maxsize)");
- return;
- }
-
- var testCaseFilter = extractArg(args, "testcasefilter"); // optional
-
- $("#div_tsbm_border").css("display", "none");
- $("#div_tsbm").css("display", "none");
- $("#div_rankings").css("display", "none");
-
- fetchRankings(
- database, host, platform, branch, sha1, testCaseFilter, maxsize);
-});