mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-02 03:12:34 +01:00
Initial commit of open source Workload Automation.
This commit is contained in:
177
wlauto/workloads/bbench/patches/bbench.js
Normal file
177
wlauto/workloads/bbench/patches/bbench.js
Normal file
@@ -0,0 +1,177 @@
|
||||
//Author: Anthony Gutierrez
|
||||
|
||||
var bb_site = [];
|
||||
var bb_results = [];
|
||||
var globalSiteIndex = 0;
|
||||
var numWebsites = 9;
|
||||
var bb_path = document.location.pathname;
|
||||
var bb_home = "file:///" + bb_path.substr(1, bb_path.lastIndexOf("bbench") + 5);
|
||||
var num_iters = 0;
|
||||
var init = false;
|
||||
|
||||
function generateSiteArray(numTimesToExecute) {
|
||||
for (i = 0; i < numTimesToExecute * numWebsites; i += numWebsites) {
|
||||
bb_site[i+0] = bb_home + "/sites/amazon/www.amazon.com/index.html";
|
||||
bb_site[i+1] = bb_home + "/sites/bbc/www.bbc.co.uk/index.html";
|
||||
bb_site[i+2] = bb_home + "/sites/cnn/www.cnn.com/index.html";
|
||||
bb_site[i+3] = bb_home + "/sites/craigslist/newyork.craigslist.org/index.html";
|
||||
bb_site[i+4] = bb_home + "/sites/ebay/www.ebay.com/index.html";
|
||||
bb_site[i+5] = bb_home + "/sites/google/www.google.com/index.html";
|
||||
// bb_site[i+6] = bb_home + "/sites/youtube/www.youtube.com/index.html";
|
||||
bb_site[i+6] = bb_home + "/sites/msn/www.msn.com/index.html";
|
||||
bb_site[i+7] = bb_home + "/sites/slashdot/slashdot.org/index.html";
|
||||
bb_site[i+8] = bb_home + "/sites/twitter/twitter.com/index.html";
|
||||
// bb_site[i+10] = bb_home + "/sites/espn/espn.go.com/index.html";
|
||||
}
|
||||
|
||||
bb_site[i] = bb_home + "/results.html";
|
||||
}
|
||||
|
||||
|
||||
/* gets the URL parameters and removes from window href */
|
||||
function getAndRemoveURLParams(windowURL, param) {
|
||||
var regex_string = "(.*)(\\?)" + param + "(=)([0-9]+)(&)(.*)";
|
||||
var regex = new RegExp(regex_string);
|
||||
var results = regex.exec(windowURL.value);
|
||||
|
||||
if (results == null)
|
||||
return "";
|
||||
else {
|
||||
windowURL.value = results[1] + results[6];
|
||||
return results[4];
|
||||
}
|
||||
}
|
||||
|
||||
/* gets the URL parameters */
|
||||
function getURLParams(param) {
|
||||
var regex_string = "(.*)(\\?)" + param + "(=)([0-9]+)(&)(.*)";
|
||||
var regex = new RegExp(regex_string);
|
||||
var results = regex.exec(window.location.href);
|
||||
|
||||
if (results == null)
|
||||
return "";
|
||||
else
|
||||
return results[4];
|
||||
}
|
||||
|
||||
/* gets all the parameters */
|
||||
function getAllParams() {
|
||||
var regex_string = "(\\?.*)(\\?siteIndex=)([0-9]+)(&)";
|
||||
var regex = new RegExp(regex_string);
|
||||
var results = regex.exec(window.location.href);
|
||||
/*alert(" Result is 1: " + results[1] + " 2: " + results[2] + " 3: " + results[3]);*/
|
||||
|
||||
if (results == null)
|
||||
return "";
|
||||
else
|
||||
return results[1];
|
||||
}
|
||||
|
||||
/* sets a cookie */
|
||||
function setCookie(c_name, value) {
|
||||
var c_value = escape(value) + ";";
|
||||
document.cookie = c_name + "=" + c_value + " path=/";
|
||||
}
|
||||
|
||||
/* gets a cookie */
|
||||
function getCookie(c_name) {
|
||||
var cookies = document.cookie.split(";");
|
||||
var i, x, y;
|
||||
|
||||
for (i = 0; i < cookies.length; ++i) {
|
||||
x = cookies[i].substr(0, cookies[i].indexOf("="));
|
||||
y = cookies[i].substr(cookies[i].indexOf("=") + 1);
|
||||
x = x.replace(/^\s+|\s+$/g,"");
|
||||
|
||||
if (x == c_name)
|
||||
return unescape(y);
|
||||
}
|
||||
}
|
||||
|
||||
/* start the test, simply go to site 1. */
|
||||
function startTest(n, del, y) {
|
||||
//var start_time = (new Date()).getTime();
|
||||
//setCookie("PreviousTime", start_time);
|
||||
|
||||
init = true;
|
||||
|
||||
generateSiteArray(n);
|
||||
siteTest(bb_site[0], globalSiteIndex, new Date().getTime(), "scrollSize=" + y + "&?scrollDelay=" + del + "&?iterations=" + n + "&?" + "StartPage");
|
||||
//siteTest(bb_site[0], globalSiteIndex, new Date().getTime(), "scrollDelay=" + del + "&?iterations=" + n + "&?" + "StartPage");
|
||||
//goToSite(bb_site[0], new Date().getTime());
|
||||
}
|
||||
|
||||
/* jump to the next site */
|
||||
function goToSite(site) {
|
||||
curr_time = new Date().getTime();
|
||||
setCookie("CGTPreviousTime", curr_time);
|
||||
site+="?CGTPreviousTime="+curr_time+"&";
|
||||
window.location.href = site;
|
||||
}
|
||||
|
||||
/*
|
||||
the test we want to run on the site.
|
||||
for now, simply scroll to the bottom
|
||||
and jump to the next site. in the
|
||||
future we will want to do some more
|
||||
realistic browsing tests.
|
||||
*/
|
||||
function siteTest(nextSite, siteIndex, startTime, siteName) {
|
||||
if (!init) {
|
||||
var iterations = getURLParams("iterations");
|
||||
var params = getAllParams();
|
||||
var delay = getURLParams("scrollDelay");
|
||||
var verticalScroll = getURLParams("scrollSize");
|
||||
generateSiteArray(iterations);
|
||||
nextSite = bb_site[siteIndex] + params;
|
||||
}
|
||||
else {
|
||||
var delay = 500;
|
||||
var verticalScroll = 500;
|
||||
}
|
||||
var cgtPreviousTime = getURLParams("CGTPreviousTime");
|
||||
var load_time = 0;
|
||||
siteIndex++;
|
||||
if (siteIndex > 1) {
|
||||
cur_time = new Date().getTime();
|
||||
// alert("previous " + cgtPreviousTime + " foo " + getCookie("CGTPreviousTime"));
|
||||
load_time = (cur_time - cgtPreviousTime);
|
||||
setCookie("CGTLoadTime", load_time);
|
||||
// diff = cur_time-startTime;
|
||||
// alert("starttime "+startTime+" currtime "+ cur_time + " diff " + diff + "load_time " + load_time );
|
||||
}
|
||||
setTimeout(function() {
|
||||
scrollToBottom(0, verticalScroll, delay,load_time,
|
||||
function(load_time_param){
|
||||
cur_time = new Date().getTime();
|
||||
load_time = (cur_time - startTime);
|
||||
//load_time = (cur_time - getCookie("PreviousTime"));
|
||||
// alert("Done with this site! " + window.cur_time + " " + startTime + " " + window.load_time);
|
||||
//alert("Done with this site! " + window.cur_time + " " + getCookie("PreviousTime") + " " + window.load_time);
|
||||
//goToSite(nextSite + "?iterations=" + iterations + "&?" + siteName + "=" + load_time + "&" + "?siteIndex=" + siteIndex + "&" );
|
||||
// alert("loadtime in cookie="+ getCookie("CGTLoadTime")+" loadtime in var="+load_time_param);
|
||||
goToSite(nextSite + "?" + siteName + "=" + load_time_param + "&" + "?siteIndex=" + siteIndex + "&" );
|
||||
}
|
||||
);},(siteIndex > 1) ? 1000 : 0);
|
||||
}
|
||||
|
||||
/*
|
||||
scroll to the bottom of the page in
|
||||
num_y pixel increments. may want to
|
||||
do some horizontal scrolling in the
|
||||
future as well.
|
||||
*/
|
||||
function scrollToBottom(num_x, num_y, del, load_time, k) {
|
||||
++num_iters;
|
||||
var diff = document.body.scrollHeight - num_y * num_iters;
|
||||
//var num_scrolls = 0;
|
||||
|
||||
if (diff > num_y) {
|
||||
//self.scrollBy(num_x, num_y);
|
||||
//setTimeout(function(){self.scrollBy(num_x, num_y); /*diff -= 100;*/ scrollToBottom(num_x, num_y, k);}, 2);
|
||||
setTimeout(function(){self.scrollBy(num_x, num_y); /*diff -= 100;*/ scrollToBottom(num_x, num_y, del, load_time,k);}, del);
|
||||
}
|
||||
else{
|
||||
k(load_time);
|
||||
}
|
||||
}
|
56
wlauto/workloads/bbench/patches/index_noinput.html
Normal file
56
wlauto/workloads/bbench/patches/index_noinput.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
|
||||
<!--
|
||||
Author: Anthony Gutierrez
|
||||
-->
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>University of Michigan - BBench 2.0</title>
|
||||
<script type="text/javascript" src="bbench.js"></script>
|
||||
<script type="text/javascript" src="forms.js"></script>
|
||||
</head>
|
||||
|
||||
<body onload="startTest(2,2000,500)">
|
||||
<!--
|
||||
<body>
|
||||
<img src="mich_engin.png" width="35%"/>
|
||||
<h2>University of Michigan BBench version 2.0</h2>
|
||||
|
||||
<form name="config_form">
|
||||
<b>Number of iterations:</b> <input type="text" name="numIterations" value="5" size="4" onchange="setIters();">
|
||||
<input type="button" value="-" name="iterPlusButton" onClick="document.config_form.numIterations.value=numItersDec(); return true;">
|
||||
<input type="button" value="+" name="iterMinusButton" onClick="document.config_form.numIterations.value=numItersInc(); return true;">
|
||||
(Number of times the page set is iterated through.)
|
||||
<br/><br/>
|
||||
|
||||
<b>Scroll Delay (ms):</b> <input type="text" name="scrollDelay" value="0" size="8" onchange="setScrollDelay();">
|
||||
<input type="button" value="-" name="scrollDelayPlusButton" onClick="document.config_form.scrollDelay.value=scrollDelayDec(); return true;">
|
||||
<input type="button" value="+" name="scrollDelayMinusButton" onClick="document.config_form.scrollDelay.value=scrollDelayInc(); return true;">
|
||||
(Number of milliseconds to pause before scrolling.)
|
||||
<br/><br/>
|
||||
|
||||
<b>Scroll Size:</b> <input type="text" name="scrollSize" value="500" size="8" onchange="setScrollSize();">
|
||||
<input type="button" value="-" name="scrollSizePlusButton" onClick="document.config_form.scrollSize.value=scrollSizeDec(); return true;">
|
||||
<input type="button" value="+" name="scrollSizeMinusButton" onClick="document.config_form.scrollSize.value=scrollSizeInc(); return true;">
|
||||
(Number of pixel to scroll.)
|
||||
<br/><br/>
|
||||
</form>
|
||||
|
||||
<p>
|
||||
<b>Click on the start button to begin the benchmark.</b>
|
||||
</p>
|
||||
<button onclick="startTest(numIters, scrollDelay, scrollSize)">start</button>
|
||||
|
||||
<p>
|
||||
If you use BBench in your work please cite our <a href="http://www.eecs.umich.edu/~atgutier/iiswc_2011.pdf">2011 IISWC paper</a>:<br/><br/>
|
||||
|
||||
A. Gutierrez, R.G. Dreslinksi, T.F. Wenisch, T. Mudge, A. Saidi, C. Emmons, and N. Paver. Full-System Analysis and Characterization
|
||||
of Interactive Smartphone Applications. <i>IEEE International Symposium on Workload Characterization</i>, 2011.
|
||||
</p>
|
||||
--!>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
158
wlauto/workloads/bbench/patches/results.html
Normal file
158
wlauto/workloads/bbench/patches/results.html
Normal file
@@ -0,0 +1,158 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
|
||||
<!--
|
||||
Author: Anthony Gutierrez
|
||||
-->
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>University of Michigan - BBench 2.0</title>
|
||||
<script type="text/javascript" src="bbench.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var numTimesToExecute = getURLParams("iterations");
|
||||
|
||||
function closeWindow() {
|
||||
window.open('','_self','');
|
||||
window.close();
|
||||
}
|
||||
|
||||
function averageWarm(siteTimes) {
|
||||
var sum = 0;
|
||||
|
||||
if (numTimesToExecute == 1)
|
||||
return siteTimes[0];
|
||||
|
||||
for (i = 0; i < numTimesToExecute - 1; ++i)
|
||||
sum = eval(sum + siteTimes[i]);
|
||||
|
||||
return (sum / (numTimesToExecute - 1));
|
||||
}
|
||||
|
||||
function stdDevWarm(siteTimes) {
|
||||
var avg = averageWarm(siteTimes)
|
||||
var tmpArray = [];
|
||||
|
||||
if (numTimesToExecute == 1)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < numTimesToExecute - 1; ++i)
|
||||
tmpArray[i] = Math.pow((siteTimes[i] - avg), 2);
|
||||
|
||||
avg = averageWarm(tmpArray);
|
||||
|
||||
return Math.sqrt(avg);
|
||||
}
|
||||
|
||||
function geoMean(avgTimes) {
|
||||
var prod = 1;
|
||||
|
||||
for (i = 0; i < numWebsites; ++i)
|
||||
prod = eval(prod * avgTimes[i]);
|
||||
|
||||
return Math.pow(prod, (1/numWebsites));
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<img src="mich_engin.png" width="35%"/>
|
||||
<h2>University of Michigan BBench version 2.0</h2>
|
||||
<h3>Results</h3>
|
||||
|
||||
<script type="text/javascript">
|
||||
var bbSiteColdTimes = [];
|
||||
var bbSiteTimes = [];
|
||||
var bbSiteAvgRunTime = [];
|
||||
var bbSiteStdDev = [];
|
||||
var bbSiteCoeffVar = [];
|
||||
var bbSiteNames = ["amazon",
|
||||
"bbc",
|
||||
"cnn",
|
||||
"craigslist",
|
||||
"ebay",
|
||||
// "espn",
|
||||
"google",
|
||||
"msn",
|
||||
"slashdot",
|
||||
"twitter"];
|
||||
// "youtube"];
|
||||
|
||||
var windowURL = new Object();
|
||||
var windowURL2 = new Object();
|
||||
windowURL.value = window.location.href;
|
||||
windowURL2.value = window.location.href;
|
||||
|
||||
for (j = 0; j < numWebsites; ++j) {
|
||||
|
||||
for (i = 0; i < numTimesToExecute; ++i) {
|
||||
var site_time = getAndRemoveURLParams(windowURL, bbSiteNames[j]) - 0;
|
||||
bbSiteTimes[i] = site_time;
|
||||
}
|
||||
|
||||
bbSiteColdTimes[j] = bbSiteTimes[i - 1];
|
||||
bbSiteAvgRunTime[j] = averageWarm(bbSiteTimes);
|
||||
bbSiteStdDev[j] = stdDevWarm(bbSiteTimes);
|
||||
bbSiteCoeffVar[j] = (bbSiteStdDev[j] / bbSiteAvgRunTime[j]) * 100;
|
||||
}
|
||||
|
||||
var bbSiteAvgGeoMean = geoMean(bbSiteAvgRunTime);
|
||||
</script>
|
||||
|
||||
<table border="1">
|
||||
<script type="text/javascript">
|
||||
document.write("<tr align=\"right\"><td>Site Name</td><td>Cold Start Time</td><td>Avg Warm Page Rendering Time (ms)</td><td>Std Dev of Warm Runs</td><td>%Coeff Var of Warm Runs</td>");
|
||||
for (i = 0; i < numWebsites; ++i) {
|
||||
document.write("<tr align=\"right\">");
|
||||
document.write("<td>" + bbSiteNames[i] + "</td>");
|
||||
document.write("<td>" + bbSiteColdTimes[i] + "</td>");
|
||||
document.write("<td>" + bbSiteAvgRunTime[i].toFixed(2) + "</td>");
|
||||
document.write("<td>" + bbSiteStdDev[i].toFixed(2) + "</td>");
|
||||
document.write("<td>" + bbSiteCoeffVar[i].toFixed(2) + "</td>");
|
||||
document.write("</tr>");
|
||||
}
|
||||
</script>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<table border="1">
|
||||
<script type="text/javascript">
|
||||
document.write("<tr><td>Geometric Mean of Average Warm Runs</td><td>" + bbSiteAvgGeoMean.toFixed(2) + "</td></tr>");
|
||||
console.log("metrics:" + "Mean = " + bbSiteAvgGeoMean.toFixed(2) + ":")
|
||||
</script>
|
||||
</table>
|
||||
|
||||
<h3>CSV version of the table:</h3>
|
||||
|
||||
<script type="text/javascript">
|
||||
document.write("Site Name,Cold Start Time, Avg Warm Page Rendering Time (ms),Std Dev of Warm Runs,%Coeff Var of Warm Runs<br />");
|
||||
for (i = 0; i < numWebsites; ++i) {
|
||||
document.write(bbSiteNames[i] + ",");
|
||||
document.write(bbSiteColdTimes[i] + ",");
|
||||
document.write(bbSiteAvgRunTime[i].toFixed(2) + ",");
|
||||
document.write(bbSiteStdDev[i].toFixed(2) + ",");
|
||||
document.write(bbSiteCoeffVar[i].toFixed(2) + "<br />");
|
||||
console.log("metrics:" + bbSiteNames[i] + "," + bbSiteColdTimes[i] + "," + bbSiteAvgRunTime[i].toFixed(2) + "," + bbSiteStdDev[i].toFixed(2) + "," + bbSiteCoeffVar[i].toFixed(2) + ":");
|
||||
}
|
||||
|
||||
document.write("<h3>Individual Site Times:</h3>");
|
||||
for (j = 0; j < numWebsites; ++j) {
|
||||
for (i = 0; i < numTimesToExecute; ++i) {
|
||||
var site_time = getAndRemoveURLParams(windowURL2, bbSiteNames[j]) - 0;
|
||||
bbSiteTimes[i] = site_time;
|
||||
document.write(bbSiteNames[j] + " load time: " + site_time + "<br />");
|
||||
}
|
||||
document.write("<br />");
|
||||
}
|
||||
setTimeout("window.location.href='http://localhost:3030/'", 1);
|
||||
</script>
|
||||
|
||||
<p>
|
||||
<b>Click the return button to go to the start page.</b>
|
||||
</p>
|
||||
<button onclick="window.location.href='index.html'">return</button>
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user