// The number of individual test iterations to do var numTests = 5;
// The type of run that we're doing (options are "runs/s" or "ms") var runStyle = "runs/s";
// A rough estimate, in seconds, of how long it'll take each test // iteration to run var timePerTest = runStyle === "runs/s" ? 1 : 0.5;
// Initialize a batch of tests // name = The name of the test collection this.startTest = function(name, version){
numloaded++; if ( numloaded == totalTests )
setTimeout( init, 100 );
// Anything that you want to have run in order, but not actually test this.prep = function(fn){ if ( !queues[testName] ) return;
queues[testID].push(function(){
fn();
dequeue();
});
};
// End the tests and finalize the report this.endTest = function(){ if ( !queues[testName] ) return; // Save the summary output until all the test are complete
queues[testID].push(function(){
dequeue();
});
};
// Run a new test // name = The unique name of the test // num = The 'length' of the test (length of string, # of tests, etc.) // fn = A function holding the test to run this.test = function(name, num, fn){ if ( !queues[testName] ) return; // Save the summary output until all the test are complete var curTest = testName, curID = testID;
if ( arguments.length === 3 ) { if ( !nameDone[name] )
nameDone[name] = 0;
nameDone[name]++;
if ( nameDone[name] != 3 ) return;
} else {
fn = num;
num = 1;
}
time += timePerTest * numTests;
testNum[curID]++;
// Don't execute the test immediately
queues[testID].push(function() {
title = name; var times = [], start, pos = 0, cur;
setTimeout(function() { // run tests try { if (doShark(name)) {
connectShark();
startShark();
}
} catch( e ) {
alert("FAIL " + name + " " + num + e); return;
}
TalosContentProfiler.subtestStart("dromaeo: begin test [" + name + "]", name, true).then(() => {
start = performance.now();
if (runStyle === "runs/s") { var runs = 0;
cur = performance.now();
while ( (cur - start) < 1000 ) {
fn();
cur = performance.now();
runs++;
}
} else {
fn();
cur = performance.now();
}
try { if (doShark(name)) {
stopShark();
disconnectShark();
}
} catch(e) {
alert("FAIL " + name + " " + num + e); return;
}
TalosContentProfiler.subtestEnd("dromaeo: test [" + name + "]", name, true).then(() => { // For making Median and Variance if (runStyle === "runs/s") {
times.push((runs * 1000) / (cur - start));
} else {
times.push(cur - start);
}
var testElems = {}; var testNum = {}; var testDone = {}; var testNames = {}; var testVersions = {}; var dataStore = []; var names = []; var interval; var totalTime = 0; var time = 0; var title, testName, testID, testSummary = {} , testSummaryNum = {}, maxTotal = 0, maxTotalNum = 0; var meanValues = []; var nameDone = {};
var none = !parts[0] || parts[0].match(/=/); var filter = parts.length && !parts[0].match(/=/) && parts[0] !== "all" ? new RegExp(parts.shift(), "i") :
/./;
// To enable shark debugging add &shark to the end of the URL var doShark = function(name) { returnfalse; }; for ( var i = 0; i < parts.length; i++ ) { var m = /^shark(?:=(.*))?$/.exec(parts[i]); if (m) { if (m[1] === undefined) {
doShark = function(name) { returntrue; };
} else { var sharkMatch = new RegExp(m[1]);
doShark = function(name) { return sharkMatch.test(name);
};
}
}
m = /^numTests=(\d+)$/.exec(parts[i]); if (m)
numTests = Number(m[1]);
}
jQuery(window).load(function(){ var id = search.match(/id=([\d,]+)/);
if ( none && !id ) {
$("#overview").hide(); return;
}
var cat = filter.toString().slice(1,-2);
if ( catnames[cat] ) {
$("#overview span:first").html( catnames[cat] );
// Check if we're loading a specific result set // ?id=NUM if ( id ) {
jQuery.ajax({
url: "store.php?id=" + id[1],
dataType: "json",
success: function(data){
resultsLoaded(id[1], data);
}
});
// Otherwise we're loading a normal set of tests
} else {
$("#wrapper").append("
// Check if we're loading an HTML file if ( test.file.match(/html$/) ) { var iframe = document.createElement("iframe");
iframe.style.height = "1px";
iframe.style.width = "1px";
iframe.src = "tests/" + test.file;
document.body.appendChild( iframe );
// Otherwise we're loading a pure-JS test
} else {
jQuery.getScript("tests/" + test.file);
}
})(names[i]);
}
});
});
// Remove the next test from the queue and execute it function dequeue(){ if ( interval && queue.length ) { if (typeof plGarbageCollect !== "undefined") {
plGarbageCollect();
}
queue.shift()();
if ( window.limitSearch ) { var summary = (runStyle === "runs/s" ? Math.pow(Math.E, maxTotal / maxTotalNum) : maxTotal).toFixed(2);
if ( typeof tpRecordTime !== "undefined" ) {
first = true;
meanString = ""; for (var i=0;i<meanValues.length; i++) { if (first == true) {
meanString = meanValues[i];
first = false;
} else {
meanString += "," + meanValues[i];
}
}
tpRecordTime( meanString );
} else { var pre = document.createElement("pre");
pre.style.display = "none";
pre.innerHTML = "__start_report" + summary + "__end_report";
document.body.appendChild( pre );
}
if ( typeof goQuitApplication !== "undefined" ) {
goQuitApplication();
}
} elseif ( dataStore && dataStore.length ) {
$("body").addClass("alldone"); var div = jQuery("
Saving...
").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: "'>" + url + "
// Run once all the test files are fully loaded function init(){ for ( var n = 0; n < names.length; n++ ) {
queue = queue.concat( queues[ names[n] ] );
}
totalTime = time;
time += timePerTest;
updateTime();
function resultsLoaded(id, datas){ var results = {}; var runs = {}; var output = ""; var excluded = []; var overview = document.getElementById("overview");
for ( var d = 0; d < datas.length; d++ ) { var data = datas[d];
runStyle = data.style;
if ( datas.length == 1 ) {
$("#overview").before("
Viewing test run #" + id + ", run on: " + data.created_at + " by: " + data.useragent + "
// testDone, testNum, testSummary
testDone[ result ] = numTests - 1;
testNum[ result ] = 1;
updateTestPos( item );
}
$("div.result-item").addClass("done");
totalTime = time = timePerTest;
updateTime();
$("#overview input").remove();
updateTimebar();
} else { // Remove results where there is only one comparison set for ( var id in results ) { var num = 0;
for ( var ntest in results[id].tests ) {
num++; if ( num > 1 ) break;
}
if ( num <= 1 ) {
excluded.push( id ); delete results[id];
}
}
for ( var result in results ) { // Skip results that we're filtering out if ( !filter.test(result) ) continue;
runTests.push(result);
if ( runStyle === "runs/s" ) { for ( var run in runs ) { var mean = results[result].total[run].mean - 0; var error = results[result].total[run].error - 0;
mean = Math.pow(Math.E, mean / results[result].total[run].num);
error = Math.pow(Math.E, error / results[result].total[run].num);
results[result].total[run].mean = mean;
results[result].total[run].error = error;
}
}
var name = tests[result] ? tests[result].name : result; var tmp = processWinner(results[result].total);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.