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 // couldn't send case 3: // client error // client error case 4: // no reply // no reply case 5: // didn't need // didn't need case 6: // validate error // validate error case 7: // client detached } } if (!$n) { echo "No done results for that app"; exit; } ksort($hist); show_stats($hist); echo "<hr>\n"; show_as_table(); echo "<hr>\n"; show_as_xml(); }
function analyze($appid, $app_version_id, $nresults) { global $hist; $clause = $app_version_id ? " and app_version_id = {$app_version_id} " : ""; $query = "select id, server_state, outcome, elapsed_time, flops_estimate from result where server_state=5 and appid={$appid} and outcome=1 and validate_state=1 {$clause} order by id desc limit {$nresults}"; $r = mysql_query($query); $n = 0; while ($result = mysql_fetch_object($r)) { handle_result($result); $n++; } if (!$n) { echo "No done results for that app"; exit; } ksort($hist); show_stats($hist); echo "<hr>\n"; show_as_table(); echo "<hr>\n"; show_as_xml(); }
show_av($avid); } } function host_history($hostid, $avid) { $rs = BoincResult::enum("hostid={$hostid} and app_version_id={$avid} and validate_state=1 order by id desc limit 100"); echo "<pre>Results for host {$hostid}\n"; $n = 0; $total = 0; foreach ($rs as $r) { $raw_credit = $r->elapsed_time * $r->flops_estimate * COBB_SCALE; $n++; $total += $raw_credit; echo "ID <a href=credit.php?resultid={$r->id}>{$r->id}</a> raw {$raw_credit}\n"; } $avg = $total / $n; echo "avg: {$avg}\n"; echo "</pre>\n"; } if (array_key_exists('resultid', $_GET)) { $resultid = $_GET['resultid']; handle_result($resultid); exit; } $hostid = $_GET['hostid']; $avid = $_GET['avid']; if ($hostid && $avid) { host_history($hostid, $avid); exit; } echo "??";