From d09ece4105c781bc1245b91cd78c7346440a193b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 18 May 2007 22:48:00 +0000 Subject: [PATCH] - fix bugs in job_times.php; it shows the correct mean and stdev now. html/ops/ job_times.php svn path=/trunk/boinc/; revision=12695 --- checkin_notes | 5 +++++ html/ops/job_times.php | 25 +++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/checkin_notes b/checkin_notes index 8871c209b7..4230698af8 100755 --- a/checkin_notes +++ b/checkin_notes @@ -5064,3 +5064,8 @@ David 18 May 2007 file_deleter.C sched_config.C,h +David 18 May 2007 + - fix bugs in job_times.php; it shows the correct mean and stdev now. + + html/ops/ + job_times.php diff --git a/html/ops/job_times.php b/html/ops/job_times.php index ab50da40c7..94cf16b2b1 100644 --- a/html/ops/job_times.php +++ b/html/ops/job_times.php @@ -7,20 +7,41 @@ db_init(); $hist = array(); $quantum = 1e10; +$mean = 0; +$count = 0; +$varsum = 0; function handle_result($result) { global $hist; global $quantum; + global $mean; + global $count; + global $varsum; + $flops = $result->cpu_time * $result->p_fpops; - //echo "$flops\n"; + //printf("%e
\n", $flops); $n = (int) ($flops/$quantum); if (!array_key_exists($n, $hist)) { $hist[$n] = 0; } $hist[$n]++; + $count++; + $delta = $flops - $mean; + $mean += $delta/$count; + $varsum += $delta*($flops-$mean); } function show_stats() { + global $mean; + global $count; + global $varsum; + global $sum; + + $stdev = sqrt($varsum/($count-1)); + printf("mean: %e
stdev: %e", $mean, $stdev); +} + +function show_stats_hist() { //deprecated global $hist; global $quantum; @@ -82,7 +103,7 @@ function show_as_table() { } $f = $i*$quantum; echo ""; - printf("%e", $f); + printf("%e ", $f); echo "\n"; } echo "";