function av_desc($gavid) { if ($gavid >= 1000000) { $appid = (int) ($gavid / 1000000); $app = BoincApp::lookup_id($appid); if (!$app) { return tra("Anonymous platform, missing app"); } $rsc_type = $gavid % 1000000; $r = rsc_name($rsc_type); return "{$app->user_friendly_name} (" . tra("anonymous platform") . ", {$r})"; } else { $av = BoincAppVersion::lookup_id($gavid); if (!$av) { return tra("Missing app version"); } $app = BoincApp::lookup_id($av->appid); if (!$app) { return tra("Missing app"); } $platform = BoincPlatform::lookup_id($av->platformid); if (!$platform) { return tra("Missing platform"); } $pc = strlen($av->plan_class) ? "({$av->plan_class})" : ""; $v = number_format($av->version_num / 100, 2); return "{$app->user_friendly_name} {$v} {$platform->name} {$pc}"; } }
function show_av($avid) { $av = BoincAppVersion::lookup_id($avid); if (!$av) { echo "app version {$avid} not found"; return; } echo "<hr>\nApp version ID: {$avid}\nplan class: {$av->plan_class}\nPFC: " . $av->pfc_avg . "\nscale: " . $av->pfc_scale . "\n"; }
function update() { $id = post_int("id"); $av = BoincAppVersion::lookup_id($id); if (!$av) { error_page("no such app version"); } $n = post_str("beta", true) ? 1 : 0; $av->update("beta={$n}"); $n = post_str("deprecated", true) ? 1 : 0; $av->update("deprecated={$n}"); $n = post_int("min_core_version"); $av->update("min_core_version={$n}"); $n = post_int("max_core_version"); $av->update("max_core_version={$n}"); echo "<b>Updated app version {$id}. This change will take effect when you restart the project.</b><p>"; }
$valid_app_versions = "{$av->id}"; } else { $valid_app_versions .= ", {$av->id}"; } } $limit_app_versions = "app_version_id IN ( {$valid_app_versions} ) AND"; $query_order = "app_version_id DESC"; } // Now that we have a valid list of app_version_nums' // let's construct the main query $main_query = "\nSELECT\n app_version_id,\n CASE\n when INSTR(host.os_name, 'Darwin') then\n (CASE WHEN INSTR(host.p_vendor, 'Power') THEN 'Darwin PPC' ELSE 'Darwin x86' END)\n when INSTR(host.os_name, 'Linux') then 'Linux'\n when INSTR(host.os_name, 'Windows') then 'Windows'\n when INSTR(host.os_name, 'SunOS') then 'SunOS'\n when INSTR(host.os_name, 'Solaris') then 'Solaris'\n when INSTR(host.os_name, 'Mac') then 'Mac'\n else {$unknown_platform}\n end AS platform,\n COUNT(*) AS total_results,\n ((SUM(case when outcome = '1' then 1 else 0 end) / COUNT(*)) * 100) AS pass_rate,\n ((SUM(case when outcome = '3' then 1 else 0 end) / COUNT(*)) * 100) AS fail_rate,\n ((SUM(case when outcome = '3' and client_state = '1' then 1 else 0 end) / COUNT(*)) * 100) AS fail_rate1,\n ((SUM(case when outcome = '3' and client_state = '2' then 1 else 0 end) / COUNT(*)) * 100) AS fail_rate2,\n ((SUM(case when outcome = '3' and client_state = '3' then 1 else 0 end) / COUNT(*)) * 100) AS fail_rate3,\n ((SUM(case when outcome = '3' and client_state = '4' then 1 else 0 end) / COUNT(*)) * 100) AS fail_rate4,\n ((SUM(case when outcome = '3' and client_state = '5' then 1 else 0 end) / COUNT(*)) * 100) AS fail_rate5,\n ((SUM(case when outcome = '3' and client_state = '6' then 1 else 0 end) / COUNT(*)) * 100) AS fail_rate6\nFROM result\n left join host on result.hostid = host.id\nWHERE\n appid = '{$query_appid}' AND\n server_state = '5' AND\n {$limit_app_versions}\n received_time > '{$query_received_time}'\nGROUP BY\n app_version_id DESC,\n platform\nORDER BY\n {$query_order}\n"; $result = mysql_query($main_query); start_table(); table_header("App version", "Total<br>Results", "Pass Rate", "Fail Rate", "Failed<br>Downloading", "Failed<br>Downloaded", "Failed<br>Computing", "Failed<br>Uploading", "Failed<br>Uploaded", "Aborted"); while ($res = mysql_fetch_object($result)) { $av = BoincAppVersion::lookup_id($res->app_version_id); $p = BoincPlatform::lookup_id($av->platformid); echo "<td align=\"left\" valign=\"top\">"; echo sprintf("%.2f", $av->version_num / 100) . " {$p->name} [{$av->plan_class}]"; echo "</td>"; echo "<td align=\"right\" valign=\"top\">"; echo $res->total_results; echo " </td>"; echo "<td align=\"right\" valign=\"top\">"; echo $res->pass_rate; echo "% </td>"; echo "<td align=\"right\" valign=\"top\">"; echo $res->fail_rate; echo "% </td>"; echo "<td align=\"right\" valign=\"top\">"; echo $res->fail_rate1;
function show_av($av_id) { $av = BoincAppVersion::lookup_id($av_id); $app = BoincApp::lookup_id($av->appid); $plat = BoincPlatform::lookup_id($av->platformid); $av_desc = "{$plat->name} {$av->plan_class}"; page_head("App version {$av_desc} credit"); start_table(); row2("PFC samples", $av->pfc_n); row2("PFC average", $av->pfc_avg); row2("PFC scale", $av->pfc_scale); row2("App", $app->user_friendly_name); end_table(); $results = BoincResult::enum("app_version_id={$av_id} and validate_state=1"); start_table(); table_header("Host/App_version", "Elapsed", "FLOPS est"); foreach ($results as $r) { $avs = av_string($r->app_version_id); table_row("<a href=credit.php?host_id={$r->hostid}&a_id={$r->app_version_id}> host {$r->hostid} AV {$avs}</a>", $r->elapsed_time, $r->flops_estimate); } end_table(); page_tail(); }