Index: chrome/test/data/dromaeo/webrunner.js |
diff --git a/chrome/test/data/dromaeo/webrunner.js b/chrome/test/data/dromaeo/webrunner.js |
index 8b0e346003255fbb495f305cc9a4fe9fde0bd7d5..63d777b8d13b1cb7cfd66f47f0460f6d561842f8 100644 |
--- a/chrome/test/data/dromaeo/webrunner.js |
+++ b/chrome/test/data/dromaeo/webrunner.js |
@@ -148,7 +148,7 @@ |
}); |
function compute(times, runs){ |
- var results = {runs: runs}, num = times.length; |
+ var results = {runs: runs}, num = times.length, middle = num/2; |
times = times.sort(function(a,b){ |
return a - b; |
@@ -171,8 +171,8 @@ |
// Make Median |
results.median = num % 2 == 0 ? |
- (times[Math.floor(num/2)] + times[Math.ceil(num/2)]) / 2 : |
- times[Math.round(num/2)]; |
+ (times[middle-1] + times[middle]) / 2 : |
+ times[Math.floor(middle)]; |
// Make Variance |
results.variance = 0; |
@@ -230,8 +230,6 @@ |
var time = 0; |
var title, testName, testID, testSummary = {} , testSummaryNum = {}, maxTotal = 0, maxTotalNum = 0; |
var nameDone = {}; |
- var automated = false; |
- var post_json = false; |
// Query String Parsing |
var search = window.limitSearch || (window.location.search || "?").substr(1); |
@@ -271,11 +269,6 @@ |
m = /^numTests=(\d+)$/.exec(parts[i]); |
if (m) |
numTests = Number(m[1]); |
- |
- if (/^automated$/.exec(parts[i])) |
- automated = true; |
- if (/^post_json$/.exec(parts[i])) |
- post_json = true; |
} |
jQuery(function(){ |
@@ -384,28 +377,17 @@ |
} |
} else if ( dataStore && dataStore.length ) { |
- if (!automated) { |
- $("body").addClass("alldone"); |
- var div = jQuery("<div class='results'>Saving...</div>").insertBefore("#overview"); |
- jQuery.ajax({ |
- type: "POST", |
- url: "store.php", |
- data: "data=" + encodeURIComponent(JSON.stringify(dataStore)) + "&style=" + runStyle, |
- success: function(id){ |
- var url = window.location.href.replace(/\?.*$/, "") + "?id=" + id; |
- div.html("Results saved. You can access them at a later time at the following URL:<br/><strong><a href='" + url + "'>" + url + "</a></strong></div>"); |
- } |
- }); |
- } else if (post_json) { |
- jQuery.ajax({ |
- type: "POST", |
- url: "store.php", |
- data: "data=" + encodeURIComponent(JSON.stringify(window.automation.GetResults())) |
- }); |
- } |
- else { |
- window.automation.SetDone(); |
- } |
+ $("body").addClass("alldone"); |
+ var div = jQuery("<div class='results'>Saving...</div>").insertBefore("#overview"); |
+ jQuery.ajax({ |
+ type: "POST", |
+ url: "store.php", |
+ data: "data=" + encodeURIComponent(JSON.stringify(dataStore)) + "&style=" + runStyle, |
+ success: function(id){ |
+ var url = window.location.href.replace(/\?.*$/, "") + "?id=" + id; |
+ div.html("Results saved. You can access them at a later time at the following URL:<br/><strong><a href='" + url + "'>" + url + "</a></strong></div>"); |
+ } |
+ }); |
} |
} |
} |
@@ -424,28 +406,20 @@ |
time += timePerTest; |
updateTime(); |
- if (!automated) { |
- $("#pause") |
- .val("Run") |
- .click(function(){ |
- if ( interval ) { |
- interval = null; |
- this.value = "Run"; |
- } else { |
- if ( !interval ) { |
- interval = true; |
- dequeue(); |
- } |
- this.value = "Pause"; |
+ $("#pause") |
+ .val("Run") |
+ .click(function(){ |
+ if ( interval ) { |
+ interval = null; |
+ this.value = "Run"; |
+ } else { |
+ if ( !interval ) { |
+ interval = true; |
+ dequeue(); |
} |
- }); |
- } else { |
- $("#pause") |
- .val("Automated") |
- .click(function(){}); |
- interval = true; |
- dequeue(); |
- } |
+ this.value = "Pause"; |
+ } |
+ }); |
if ( window.limitSearch ) { |
$("#pause").click(); |
@@ -804,45 +778,4 @@ |
updateTestPos({curID: testID, collection: tests[testID] ? tests[testID].name : testID, version: testVersions[testID]}, true); |
} |
- |
- if (automated) { |
- // Add some more stuff if running in automated mode. |
Nico
2016/11/14 22:20:58
we're not using this, yes?
dvallet
2016/11/15 02:19:38
Not really sure, it seems like it just adds some e
Nico
2016/11/15 15:30:06
The readme says "This benchmark was slightly modif
dvallet
2016/11/15 23:18:05
I'm fairly certain that the automation bit was add
|
- window.automation = {} |
- window.automation.SetDone = function() { |
- console.log("Total: " + this.GetScore()); |
- window.document.cookie = "__done=1; path=/"; |
- } |
- window.automation.GetScore = function() { |
- return (runStyle === "runs/s" ? Math.pow(Math.E, maxTotal / maxTotalNum) : maxTotal).toString(); |
- } |
- window.automation.GetResults = function() { |
- var results = {}; |
- var aggregated = {}; |
- function normalizeName(name) { |
- // At least for ui_tests, dots are not allowed. |
- return name.replace(".", "_"); |
- } |
- function appendToAggregated(name, value) { |
- name = normalizeName(name); |
- (aggregated[name] || (aggregated[name] = [])).push(Math.log(value)); |
- } |
- |
- for (var i = 0; i < dataStore.length; i++) { |
- var data = dataStore[i]; |
- var topName = data.collection.split("-", 1)[0]; |
- appendToAggregated(topName, data.mean); |
- appendToAggregated(data.collection, data.mean); |
- results[normalizeName(data.collection + "/" + data.name)] = data.mean.toString(); |
- } |
- |
- for (var name in aggregated) { |
- var means = aggregated[name]; |
- var sum = 0; |
- for (var i = 0; i < means.length; i++) sum += means[i]; |
- results[name] = Math.pow(Math.E, sum/means.length).toString(); |
- } |
- |
- return results; |
- } |
- } |
})(); |