diff --git a/html/inc/consent.inc b/html/inc/consent.inc index 31d094229e..4b8553c0b1 100644 --- a/html/inc/consent.inc +++ b/html/inc/consent.inc @@ -18,11 +18,16 @@ // functions dealing with the consent and consent_type tables. -include_once("../inc/boinc_db.inc"); -include_once("../inc/util.inc"); +require_once("../inc/boinc_db.inc"); +require_once("../inc/util.inc"); define('CONSENT_TYPE_ENROLL','ENROLL'); +// Utility function to check the terms of use. +function check_termsofuse() { + return defined('TERMSOFUSE_FILE') and file_exists(TERMSOFUSE_FILE); +} + function consent_to_a_policy($user, $consent_type_id, $consent_flag, $consent_not_required, $source, $ctime = 0) { $mys = BoincDb::escape_string($source); if ($ctime==0) { diff --git a/html/inc/result.inc b/html/inc/result.inc index efde9b975d..1c0195ee2c 100644 --- a/html/inc/result.inc +++ b/html/inc/result.inc @@ -707,16 +707,15 @@ function show_result($result, $show_outfile_links=false) { row2(tra("Device peak FLOPS"), number_format($result->flops_estimate/1e9, 2)." GFLOPS"); row2(tra("Application version"), app_version_string($result)); if ($result->peak_working_set_size) { - $x = number_format($result->peak_working_set_size/MEGA, 2); - row2("Peak working set size", "$x MB"); + row2("Peak working set size", + size_string($result->peak_working_set_size) + ); } if ($result->peak_swap_size) { - $x = number_format($result->peak_swap_size/MEGA, 2); - row2("Peak swap size", "$x MB"); + row2("Peak swap size", size_string($result->peak_swap_size)); } if ($result->peak_disk_usage) { - $x = number_format($result->peak_disk_usage/MEGA, 2); - row2("Peak disk usage", "$x MB"); + row2("Peak disk usage", size_string($result->peak_disk_usage)); } if ($show_outfile_links && $result->outcome == 1) { $fanout = parse_config(get_config(), ""); diff --git a/html/inc/util.inc b/html/inc/util.inc index 0ea0c9ac81..37af6ff1d7 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -1148,9 +1148,13 @@ function text_end() { echo "\n"; } -// Utility function to check the terms of use. -function check_termsofuse() { - return defined('TERMSOFUSE_FILE') and file_exists(TERMSOFUSE_FILE); +// express a size in terms of GB or MB +// +function size_string($x) { + if ($x > GIGA) { + return number_format($x/GIGA, 2)." GB"; + } + return number_format($x/MEGA, 2)." MB"; } function cert_filename() { diff --git a/html/user/submit.php b/html/user/submit.php index 1069a67f13..9e59616320 100644 --- a/html/user/submit.php +++ b/html/user/submit.php @@ -299,6 +299,62 @@ function handle_admin($user) { page_tail(); } + +// show the statics of mem/disk usage of jobs in a batch +// +function handle_batch_stats($user) { + $batch_id = get_int('batch_id'); + $batch = BoincBatch::lookup_id($batch_id); + $results = BoincResult::enum("batch = $batch->id"); + page_head("Statistics for batch $batch_id"); + $n = 0; + $wss_sum = 0; + $swap_sum = 0; + $disk_sum = 0; + $wss_max = 0; + $swap_max = 0; + $disk_max = 0; + foreach ($results as $r) { + if ($r->outcome != RESULT_OUTCOME_SUCCESS) { + continue; + } + // pre-7.3.16 clients don't report usage info + // + if ($r->peak_working_set_size == 0) { + continue; + } + $n++; + $wss_sum += $r->peak_working_set_size; + if ($r->peak_working_set_size > $wss_max) { + $wss_max = $r->peak_working_set_size; + } + $swap_sum += $r->peak_swap_size; + if ($r->peak_swap_size > $swap_max) { + $swap_max = $r->peak_swap_size; + } + $disk_sum += $r->peak_disk_usage; + if ($r->peak_disk_usage > $disk_max) { + $disk_max = $r->peak_disk_usage; + } + } + if ($n == 0) { + echo "No qualifying results."; + page_tail(); + return; + } + start_table(); + row2("qualifying results", $n); + row2("mean WSS", size_string($wss_sum/$n)); + row2("max WSS", size_string($wss_max)); + row2("mean swap", size_string($swap_sum/$n)); + row2("max swap", size_string($swap_max)); + row2("mean disk usage", size_string($disk_sum/$n)); + row2("max disk usage", size_string($disk_max)); + end_table(); + + page_tail(); +} + // show the details of an existing batch // function handle_query_batch($user) { @@ -323,14 +379,10 @@ function handle_query_batch($user) { } row2("GFLOP/hours, estimated", number_format(credit_to_gflop_hours($batch->credit_estimate), 2)); row2("GFLOP/hours, actual", number_format(credit_to_gflop_hours($batch->credit_canonical), 2)); - row2("Output File Size (MB)", number_format(batch_output_file_size($batch->id)/1e6,2)); + row2("Output File Size", size_string(batch_output_file_size($batch->id))); end_table(); - if (batch_output_file_size($batch->id) <= 1e8) { - $url = boinc_get_output_files_url($user, $batch_id); - show_button($url, "Get zipped output files"); - } else { - echo "
The output file size of this batch is too big, it will be uploaded by FTP
"; - } + $url = boinc_get_output_files_url($user, $batch_id); + show_button($url, "Get zipped output files"); switch ($batch->state) { case BATCH_STATE_IN_PROGRESS: echo "

"; @@ -348,6 +400,9 @@ function handle_query_batch($user) { ); break; } + show_button("submit.php?action=batch_stats&batch_id=$batch_id", + "Show memory/disk usage statistics" + ); echo "

Jobs

\n"; start_table(); @@ -577,6 +632,7 @@ case '': handle_main($user); break; case 'abort_batch': handle_abort_batch($user); break; case 'abort_batch_confirm': handle_abort_batch_confirm(); break; case 'admin': handle_admin($user); break; +case 'batch_stats': handle_batch_stats($user); break; case 'query_batch': handle_query_batch($user); break; case 'query_job': handle_query_job($user); break; case 'retire_batch': handle_retire_batch($user); break;