diff --git a/html/ops/credit_study.php b/html/ops/credit_study.php
new file mode 100644
index 0000000000..5d32ecd775
--- /dev/null
+++ b/html/ops/credit_study.php
@@ -0,0 +1,109 @@
+p_fpops*$fpw + $x->p_iops*(1-$fpw);
+ $cps /= 1e9;
+ $cps /= 864;
+ $cc = $x->cpu_time * $cps;
+ //if ($x->duration_correction_factor) {
+ // $cc /= $x->duration_correction_factor;
+ //}
+ return $cc;
+}
+
+// $x is a vector of objects
+//
+function handle_wu($x) {
+ $cc = array();
+ for ($i=0; $i<=12; $i++) {
+ array_push($cc, array());
+ }
+ for ($j=0; $j0 limit 10000"
+ );
+ $n = 0;
+ while ($wu = mysql_fetch_object($r1)) {
+ $x = array();
+ $r2 = mysql_query("select * from result where workunitid=$wu->id");
+ $found_zero = false;
+ while ($result = mysql_fetch_object($r2)) {
+ if ($result->granted_credit==0) continue;
+ if ($result->claimed_credit==0) $found_zero = true;
+ $host = lookup_host($result->hostid);
+ $y->claimed_credit = $result->claimed_credit;
+ $y->granted_credit = $result->granted_credit;
+ $y->cpu_time = $result->cpu_time;
+ $y->p_fpops = $host->p_fpops;
+ $y->p_iops = $host->p_iops;
+ $y->duration_correction_factor = $host->duration_correction_factor;
+ $y->id = $result->id;
+ array_push($x, $y);
+ }
+ if (count($x)==0) continue;
+ if ($found_zero) continue;
+ $res = handle_wu($x);
+ for ($i=0; $i<=12; $i++) {
+ $sum[$i] += $res[$i];
+ }
+ $n++;
+ }
+ for ($i=0; $i<=12; $i++) {
+ $r = $sum[$i]/$n;
+ echo "$i $r\n";
+ }
+}
+
+
+get_data();
+
+?>