mirror of https://github.com/BOINC/boinc.git
Fixed errors in uc_cpu/test_time.php
svn path=/trunk/boinc/; revision=287
This commit is contained in:
parent
22650b5bbb
commit
654767cf95
|
@ -82,6 +82,11 @@ int boinc_finish(int status) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int boinc_get_init_data(APP_INIT_DATA& app_init_data) {
|
||||
app_init_data = aid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// resolve XML soft links
|
||||
//
|
||||
int boinc_resolve_filename(char *virtual_name, char *physical_name) {
|
||||
|
|
|
@ -30,10 +30,16 @@
|
|||
|
||||
#define CHECKPOINT_FILE "uc_slow_state"
|
||||
|
||||
time_t my_start_time;
|
||||
|
||||
int do_checkpoint(MFILE& mf, int nchars) {
|
||||
int retval;
|
||||
char resolved_name[512],res_name2[512];
|
||||
FILE *app_time = fopen("../../app.time", "w"),
|
||||
*client_time = fopen("../../client.time", "w");
|
||||
APP_INIT_DATA aid;
|
||||
|
||||
boinc_get_init_data(aid);
|
||||
boinc_resolve_filename( "temp", resolved_name );
|
||||
FILE* f = fopen(resolved_name, "w");
|
||||
if (!f) return 1;
|
||||
|
@ -50,16 +56,29 @@ int do_checkpoint(MFILE& mf, int nchars) {
|
|||
if (retval) return retval;
|
||||
// hopefully atomic part ends here
|
||||
|
||||
// print our own information about cpu time
|
||||
fprintf(app_time, "%f\n", difftime(time(0), my_start_time));
|
||||
fflush(app_time);
|
||||
fclose(app_time);
|
||||
|
||||
// print what the client thinks is our cpu time
|
||||
fprintf(client_time, "%f\n", aid.wu_cpu_time + boinc_cpu_time());
|
||||
fflush(client_time);
|
||||
fclose(client_time);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int c, nchars = 0, retval, n, i;
|
||||
int c, nchars = 0, retval, n;
|
||||
unsigned long int i;
|
||||
double j;
|
||||
char resolved_name[512];
|
||||
MFILE out, time_file;
|
||||
FILE* state, *in;
|
||||
|
||||
my_start_time = time(0);
|
||||
|
||||
boinc_init();
|
||||
|
||||
boinc_resolve_filename( "in", resolved_name );
|
||||
|
@ -91,7 +110,7 @@ int main() {
|
|||
|
||||
n = 0;
|
||||
j = 3.14159;
|
||||
for(i=0; i<10000000; i++) {
|
||||
for(i=0; i<200000000; i++) {
|
||||
n++;
|
||||
j *= n+j-3.14159;
|
||||
j /= (float)n;
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
|
||||
include_once("init.inc");
|
||||
|
||||
$app_time = 0;
|
||||
check_env_vars();
|
||||
clear_db();
|
||||
clear_data_dirs();
|
||||
create_keys();
|
||||
init_client_dirs("prefs1.xml");
|
||||
copy_to_download_dir("small_input");
|
||||
|
@ -15,13 +17,13 @@
|
|||
add_core_client(null);
|
||||
add_user("prefs.xml");
|
||||
add_app("uc_cpu", null, null);
|
||||
create_work("-appname uc_cpu -rsc_fpops 4500000000 -rsc_iops 500000000 -wu_name uccpu_wu -wu_template uccpu_wu -result_template uccpu_result -nresults 1 small_input");
|
||||
create_work("-appname uc_cpu -rsc_fpops 4500000000.0 -rsc_iops 500000000.0 -wu_name uccpu_wu -wu_template uccpu_wu -result_template uccpu_result -nresults 1 small_input");
|
||||
start_feeder();
|
||||
run_client("-exit_after 12");
|
||||
$app_time = get_time("app_time");
|
||||
run_client("-exit_after 400");
|
||||
$app_time += get_time("app.time");
|
||||
PassThru("cp client_state.xml client_state.xml.one");
|
||||
run_client("-exit_when_idle");
|
||||
$app_time += get_time("app_time");
|
||||
$app_time += get_time("app.time");
|
||||
compare_file("uccpu_wu_0_0", "uc_small_correct_output");
|
||||
compare_time($app_time);
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue