diff --git a/html/inc/submit.inc b/html/inc/submit.inc
index 5e2c16c7d1..dd323ce3f8 100644
--- a/html/inc/submit.inc
+++ b/html/inc/submit.inc
@@ -188,8 +188,12 @@ function boinc_submit_batch($req) {
}
function boinc_query_batches($req) {
+ $get_cpu_time =
+ empty($req->get_cpu_time)?" 1\n":""
+ ;
$req_xml = "
$req->authenticator
+$get_cpu_time
";
list($reply, $errmsg) = do_http_op($req, $req_xml, "");
@@ -203,9 +207,13 @@ function boinc_query_batches($req) {
}
function boinc_query_batch($req) {
+ $get_cpu_time =
+ empty($req->get_cpu_time)?" 1\n":""
+ ;
$req_xml = "
$req->authenticator
$req->batch_id
+$get_cpu_time
";
list($reply, $errmsg) = do_http_op($req, $req_xml, "");
diff --git a/html/inc/submit_db.inc b/html/inc/submit_db.inc
index 200f89ddda..61c6e6b84b 100644
--- a/html/inc/submit_db.inc
+++ b/html/inc/submit_db.inc
@@ -48,6 +48,14 @@ class BoincBatch {
$db = BoincDb::get();
return $db->update_aux('batch', $clause);
}
+ function get_cpu_time() {
+ $db = BoincDb::get();
+ $x = $db->get_double(
+ "select sum(result.cpu_time) as total_cpu_time from workunit join result on workunit.id = result.workunitid where workunit.batch=$this->id",
+ "total_cpu_time"
+ );
+ return $x;
+ }
}
class BoincUserSubmit {
@@ -146,19 +154,4 @@ class BoincBatchFileAssoc {
}
}
-class BoincBatchTotalCPUTime {
- static function get_cpu_time($batch_id) {
- $db = BoincDb::get();
- $id = (int)$batch_id;
-
- $x = $db->get_double(
- "select sum(result.cpu_time) as total_cpu_time from workunit join result on workunit.id = result.workunitid where workunit.batch=$id",
- "total_cpu_time"
- );
-
- return $x;
- }
-}
-
-
?>
diff --git a/html/user/submit_example.php b/html/user/submit_example.php
index 611657df2e..40f51f547f 100644
--- a/html/user/submit_example.php
+++ b/html/user/submit_example.php
@@ -111,14 +111,13 @@ function handle_main() {
$first = false;
echo "
Completed batches
\n";
start_table();
- table_header("name", "ID", "# jobs", "submitted", "CPU Time");
+ table_header("name", "ID", "# jobs", "submitted");
}
table_row(
"id>$batch->name",
"id>$batch->id",
$batch->njobs,
- local_time_str($batch->create_time),
- BoincBatchTotalCPUTime::get_cpu_time($batch->id)
+ local_time_str($batch->create_time)
);
}
if ($first) {
diff --git a/html/user/submit_rpc_handler.php b/html/user/submit_rpc_handler.php
index 50cac384d2..91cc696894 100644
--- a/html/user/submit_rpc_handler.php
+++ b/html/user/submit_rpc_handler.php
@@ -354,7 +354,7 @@ function create_batch($r) {
echo "$batch_id\n";
}
-function print_batch_params($batch) {
+function print_batch_params($batch, $get_cpu_time) {
$app = BoincApp::lookup_id($batch->app_id);
if (!$app) $app->name = "none";
echo "
@@ -372,14 +372,15 @@ function print_batch_params($batch) {
$batch->name
$app->name
";
- echo " ";
- echo BoincBatchTotalCPUTime::get_cpu_time($batch->id);
- echo "\n";
+ if ($get_cpu_time) {
+ echo " ".$batch->get_cpu_time()."\n";
+ }
}
function query_batches($r) {
list($user, $user_submit) = authenticate_user($r, null);
$batches = BoincBatch::enum("user_id = $user->id");
+ $get_cpu_time = (int)($r->get_cpu_time);
echo "\n";
foreach ($batches as $batch) {
if ($batch->state < BATCH_STATE_COMPLETE) {
@@ -387,7 +388,7 @@ function query_batches($r) {
$batch = get_batch_params($batch, $wus);
}
echo " \n";
- print_batch_params($batch);
+ print_batch_params($batch, $get_cpu_time);
echo " \n";
}
echo "\n";
@@ -426,7 +427,8 @@ function query_batch($r) {
$wus = BoincWorkunit::enum("batch = $batch->id");
$batch = get_batch_params($batch, $wus);
echo "\n";
- print_batch_params($batch);
+ $get_cpu_time = (int)($r->get_cpu_time);
+ print_batch_params($batch, $get_cpu_time);
$n_outfiles = n_outfiles($wus[0]);
foreach ($wus as $wu) {
echo "