diff --git a/checkin_notes b/checkin_notes index ee77b9f01f..bf24fdccb0 100755 --- a/checkin_notes +++ b/checkin_notes @@ -3476,3 +3476,9 @@ Rom 12 Apr 2007 zlib/ + +David 12 Apr 2007 + - added script for getting statistics on job FLOP counts + + html/ops/ + job_times.php diff --git a/html/ops/job_times.php b/html/ops/job_times.php new file mode 100644 index 0000000000..12e227a948 --- /dev/null +++ b/html/ops/job_times.php @@ -0,0 +1,171 @@ +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 ""; + $keys = array_keys($hist); + $start = reset($keys); + $end = end($keys); + + $max = $hist[$start]; + foreach ($hist as $v) { + if ($v > $max) $max = $v; + } + + for ($i=$start; $i<=$end; $i++) { + if (array_key_exists($i, $hist)) { + $w = 600*$hist[$i]/$max; + } else { + $w = 0; + } + $f = $i*$quantum; + echo "\n"; + } + echo "
"; + printf("%e", $f); + echo "
"; +} + +function show_apps() { + 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 + } + } + + ksort($hist); + show_stats($hist); + echo "


\n"; + show_as_table($hist); + echo "
\n"; + show_as_xml($hist); +} + +function show_form() { + echo " +
+ App ID: +
platform ID (0 for all): +
FLOP quantum: +
# of results: +
+
+ "; + show_platforms(); + show_apps(); +} + +if ($_GET['submit']=='OK') { + $appid = $_GET['appid']; + $platformid = $_GET['platformid']; + $quantum = $_GET['quantum']; + $nresults = $_GET['nresults']; + analyze($appid, $platformid, $nresults); +} else { + show_form(); +} + +?>