~ubuntu-branches/ubuntu/precise/boinc/precise

« back to all changes in this revision

Viewing changes to html/inc/db_ops.inc

Tags: 6.12.8+dfsg-1
* New upstream release.
* Simplified debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
// You should have received a copy of the GNU Lesser General Public License
17
17
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18
18
 
 
19
error_reporting(E_ALL);
 
20
ini_set('display_errors', true);
 
21
ini_set('display_startup_errors', true);
 
22
 
19
23
class BoincAssignment {
20
24
    static function enum($where_clause) {
21
25
        $db = BoincDb::get();
881
885
    ";
882
886
}
883
887
 
 
888
function days_string($x) {
 
889
    return number_format($x/86400, 2)." days";
 
890
}
 
891
 
 
892
function resource_name($x) {
 
893
    switch ($x) {
 
894
    case 2: return "CPU";
 
895
    case 3: return "NVIDIA";
 
896
    case 4: return "ATI";
 
897
    }
 
898
    return "Unknown resource: $x";
 
899
}
 
900
function app_version_string($avid) {
 
901
    if ($avid > 1000000) {
 
902
        $appid = (int)($avid/1000000);
 
903
        $platform_name = "Anonymous platform";
 
904
        $version_info = resource_name($avid%1000000);
 
905
    } else {
 
906
        $av = BoincAppVersion::lookup("id=$avid");
 
907
        if (!$av) return "Missing app version $avid";
 
908
        $appid = $av->appid;
 
909
        $platform = BoincPlatform::lookup_id($av->platformid);
 
910
        if (!$platform) return "Missing platform $av->platformid";
 
911
        $platform_name = $platform->user_friendly_name;
 
912
        $version_info = "$av->version_num $av->plan_class
 
913
            <br>PFC: $av->pfc_avg ($av->pfc_n)
 
914
            <br>scale: $av->pfc_scale
 
915
        ";
 
916
    }
 
917
    $app = BoincApp::lookup_id($appid);
 
918
    if (!$app) return "Missing app $appid";
 
919
    return "$app->user_friendly_name
 
920
        <br>$platform_name
 
921
        <br>$version_info
 
922
    ";
 
923
}
 
924
 
 
925
function show_host_app_versions($hostid) {
 
926
    start_table();
 
927
    table_header("app version", "PFC", "Elapsed", "Turnaround");
 
928
    $havs = BoincHostAppVersion::enum("host_id=$hostid");
 
929
    foreach ($havs as $hav) {
 
930
        table_row(
 
931
            app_version_string($hav->app_version_id),
 
932
            "$hav->pfc_avg ($hav->pfc_n)",
 
933
            "$hav->et_avg ($hav->et_n)",
 
934
            days_string($hav->turnaround_avg)." ($hav->turnaround_n)"
 
935
        );
 
936
    }
 
937
    end_table();
 
938
}
 
939
 
884
940
function show_host($host) {
885
941
    start_table();
886
942
 
891
947
    );
892
948
 
893
949
    row("Venue", $host->venue);
 
950
    row("Info", $host->serialnum);
894
951
    row("Total credit", $host->total_credit);
895
952
    row("Average credit", $host->expavg_credit);
896
953
    row("Average update time", time_str($host->expavg_time));
902
959
    row("Local Standard Time", "UTC $x hours");
903
960
    row("Number of CPUs", $host->p_ncpus);
904
961
    row("CPU", "$host->p_vendor $host->p_model");
905
 
    row("FP ops/sec", $host->p_fpops);
906
 
    row("Int ops/sec", $host->p_iops);
 
962
    row("GFLOPS", number_format($host->p_fpops/1e9, 2));
 
963
    row("GIOPS", number_format($host->p_iops/1e9, 2));
907
964
    row("memory bandwidth", $host->p_membw);
908
965
    row("Operating System", "$host->os_name $host->os_version");
909
966
    $x = $host->m_nbytes/(1024*1024);
923
980
    row("Free Disk Space", "$y GB");
924
981
    row("Avg network bandwidth (upstream)", "$host->n_bwup bytes/sec");
925
982
    row("Avg network bandwidth (downstream)", "$host->n_bwdown bytes/sec");
926
 
    $x = $host->avg_turnaround/86400;
927
 
    row("Average turnaround", round($x, 2)." days");
 
983
    row("Average turnaround", days_string($host->avg_turnaround));
928
984
    row("Number of RPCs", $host->rpc_seqno);
929
985
    row("Last RPC", time_str($host->rpc_time));
930
986
    row("% of time client on", 100*$host->on_frac." %");
933
989
    row("# of results today", $host->nresults_today);
934
990
    row("Results", "<a href=\"db_action.php?table=result&detail=low&hostid=$host->id&sort_by=sent_time\">click here</a>");
935
991
    end_table();
936
 
 
 
992
    show_host_app_versions($host->id);
937
993
}
938
994
 
939
995
function wu_error_mask_str($s) {
1185
1241
    row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">" . host_name_by_id($result->hostid) . "</a> [$result->hostid]");
1186
1242
    row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">" . user_name_by_id($result->userid) . "</a> [$result->userid]");
1187
1243
    row("CPU time", $result->cpu_time);
1188
 
    row("XML doc in", "<pre>".htmlspecialchars($result->xml_doc_in)."</pre>");
1189
 
    row("XML doc out", "<pre>".htmlspecialchars($result->xml_doc_out)."</pre>");
1190
 
    row("stderr out", "<pre>".htmlspecialchars($result->stderr_out)."</pre>");
 
1244
    row("Elapsed time", $result->elapsed_time);
1191
1245
    if($error=stderr_error_string($result->stderr_out)) {
1192
1246
        row("error in stderr out", $error);
1193
1247
    }
1198
1252
    row("Granted credit", $result->granted_credit);
1199
1253
    row("Application", "<a href=\"db_action.php?table=app&id=$result->appid\">".app_name_by_id($result->appid)."</a>");
1200
1254
    row("App version", "<a href=\"db_action.php?table=app_version&appid=$result->appid&clauses=version_num%3D$result->app_version_num\">".$result->app_version_num."</a>");
 
1255
    row("App version ID", $result->app_version_id);
 
1256
    row("Estimated GFLOPS", number_format($result->flops_estimate/1e9, 2));
1201
1257
    row("Random",$result->random);
1202
1258
    row("Opaque",$result->opaque);
1203
1259
    row("Teamid",$result->teamid);
1204
1260
    row("Priority",$result->priority);
 
1261
    row("XML doc in", "<pre>".htmlspecialchars($result->xml_doc_in)."</pre>");
 
1262
    row("XML doc out", "<pre>".htmlspecialchars($result->xml_doc_out)."</pre>");
 
1263
    row("stderr out", "<pre>".htmlspecialchars($result->stderr_out)."</pre>");
1205
1264
    end_table();
1206
 
    echo "<div align=\"center\">";
1207
 
    echo "<a href=\"show_log.php?s=$result->name\">GREP LOGS FOR THIS RESULT</a>";
1208
 
    echo "</div>";
1209
 
    echo "<p>";
 
1265
    echo "
 
1266
        <center>
 
1267
        <a href=\"show_log.php?s=$result->name\">GREP LOGS FOR THIS RESULT</a>
 
1268
        </center>
 
1269
        <p>
 
1270
    ";
1210
1271
}
1211
1272
 
1212
1273
function result_short_header() {
1256
1317
            $received = "<font color=\"#ff3333\">". time_str($result->report_deadline) . "</font>";
1257
1318
        }
1258
1319
    }
1259
 
    $version = $result->app_version_num;
 
1320
    $version = "$result->app_version_num/$result->app_version_id";
1260
1321
    $outcome_color = outcome_color($result->outcome);
1261
1322
    $validate_color = validate_color($result->validate_state);
1262
1323
    $host_user = host_user_link($result->hostid);
1263
1324
    $cpu_hours = sprintf("%.1f",$result->cpu_time / 3600);
1264
1325
    $claimed_credit = credit_str($result->claimed_credit);
1265
 
    $granted_credit = credit_str($result->granted_credit);
 
1326
    $granted_credit = "<a href=credit.php?resultid=$result->id>".credit_str($result->granted_credit)."</a>";
1266
1327
    $delete_state = file_delete_state_str($result->file_delete_state);
1267
1328
 
1268
1329
    echo "
1438
1499
    }
1439
1500
}
1440
1501
 
1441
 
$cvs_version_tracker[]="\$Id: db_ops.inc 15975 2008-09-07 07:40:56Z davea $";  //Generated automatically - do not edit
 
1502
$cvs_version_tracker[]="\$Id: db_ops.inc 21693 2010-06-04 19:20:19Z boincadm $";  //Generated automatically - do not edit
1442
1503
?>