cpu_time * $result->p_fpops;
//echo "$flops\n";
$n = (int) ($flops/$quantum);
if (!array_key_exists($n, $hist)) {
$hist[$n] = 0;
}
$hist[$n]++;
}
function show_stats() {
global $hist;
global $quantum;
$sum = 0;
$n = 0;
foreach ($hist as $i=>$v) {
$sum += $quantum*$i*$v;
$n += $v;
}
$mean = $sum/$n;
echo "mean: ";
printf("%e", $mean);
$sum = 0;
foreach ($hist as $i=>$v) {
$d = ($mean - $quantum*$i);
$sum += $d*$d*$v;
}
$stdev = sqrt($sum/$n);
echo "
stdev: ";
printf("%e", $stdev);
}
function show_as_xml() {
global $hist;
global $quantum;
echo "
"; foreach ($hist as $i=>$v) { echo "<bin> <value>"; printf("%e", $quantum*$i); echo "</value> <count>$v</count> </bin> "; } echo ""; } function show_as_table() { global $quantum; global $hist; echo "
"; printf("%e", $f); echo " |
Apps:";
$r = mysql_query("select * from app");
while ($p = mysql_fetch_object($r)) {
echo "
$p->id $p->user_friendly_name\n";
}
}
function show_platforms() {
echo "
Platforms:
0 All
1 Windows only
2 Darwin only
3 Linux only
";
}
function analyze($appid, $platformid, $nresults) {
global $hist;
$clause = "";
switch ($platformid) {
case 0: $clause = ""; break;
case 1: $clause = " and locate('Windows', os_name)"; break;
case 2: $clause = " and locate('Darwin', os_name)"; break;
case 3: $clause = " and locate('Linux', os_name)"; break;
}
$query = "select server_state, outcome, cpu_time, p_fpops from result, host where server_state=5 and appid=$appid and host.id = result.hostid $clause limit $nresults";
$r = mysql_query($query);
$n = 0;
while ($result = mysql_fetch_object($r)) {
switch ($result->outcome) {
case 1: // success
handle_result($result);
$n++;
break;
case 2: // couldn't send
case 3: // client error
case 4: // no reply
case 5: // didn't need
case 6: // validate error
case 7: // client detached
}
}
if (!$n) {
echo "No done results for that app";
exit;
}
ksort($hist);
show_stats($hist);
echo "