function show_result($r, $w) { $gavid = gavid($r->app_version_id, $w->appid); $hav = BoincHostAppVersion::lookup($r->hostid, $gavid); $av = BoincAppVersion::lookup_id($r->app_version_id); $raw_credit = $r->elapsed_time * $r->flops_estimate * COBB_SCALE; echo "<hr><pre>\nResult ID: <a href=db_action.php?table=result&id={$r->id}>{$r->id}</a>\nHost: <a href=credit.php?hostid={$r->hostid}&avid={$r->app_version_id}>{$r->hostid}</a>\nelapsed_time: {$r->elapsed_time}\nflops_estimate: " . $r->flops_estimate / 1000000000.0 . "\napp_version_id: {$r->app_version_id}\n"; if ($av) { $host_scale = $av->pfc_avg / $hav->pfc_avg; $av_scale = $av->pfc_scale; echo "app version scale: {$av->pfc_scale}\n"; } else { $host_scale = 1; $av_scale = 1; } echo "host scale: {$host_scale}\nCredit:\n Original: {$r->claimed_credit}\n Raw: {$raw_credit}\n Scaled: " . $raw_credit * $host_scale * $av_scale . "\n Granted: {$r->granted_credit}\n"; if ($hav) { echo "Host app version:\n PFC avg: {$hav->pfc_avg}\n"; } }
function show_host_av($host_id, $av_id) { $hav = BoincHostAppVersion::lookup("host_id={$host_id} and {$app_version_id}={$av_id}"); page_head("Host {$host_id} / app_version {$av_id} credit"); echo "Results"; $rs = BoincResult::enum("hostid={$hostid} and app_version_id={$avid} and validate_state=1 order by id desc limit 100"); start_table(); table_header("Workunit", "Elapsed", "Proj FLOPS", "Raw credit", "granted"); $n = 0; $total = 0; foreach ($rs as $r) { $raw_credit = $r->elapsed_time * $r->flops_estimate * COBB_SCALE; $n++; $total += $raw_credit; table_row("<a href=credit.php?wu_id={$r->workunitid}>{$r->workunitid}</a>", $r->elapsed_time, $r->projected_flops, $raw_credit, $r->granted_credit); } start_table(); row2("PFC nsamples", $hav->pfc_n); row2("PFC avg", $hav->pfc_avg); row2("Average raw credit", $total / $n); end_table(); page_tail(); }