diff --git a/api/boinc_api.C b/api/boinc_api.C index 57bd54c9ea..59b74d1f2c 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -298,12 +298,16 @@ int boinc_worker_thread_cpu_time(double &cpu_t, double &ws_t) { if (retval) { fprintf(stderr, "error: could not get CPU time\n"); return ERR_GETRUSAGE; - } + } // Sum the user and system time spent in this process cpu_t = (double)ru.ru_utime.tv_sec + (((double)ru.ru_utime.tv_usec) / ((double)1000000.0)); cpu_t += (double)ru.ru_stime.tv_sec + (((double)ru.ru_stime.tv_usec) / ((double)1000000.0)); ws_t = ru.ru_idrss; // TODO: fix this (mult by page size) - return 0; + return 0; +} + +int boinc_thread_cpu_time(double& cpu, double& ws) { + return boinc_thread_cpu_time(cpu, ws); } #endif #endif // _WIN32 diff --git a/apps/upper_case.C b/apps/upper_case.C index 872552e9c8..fae8c00111 100755 --- a/apps/upper_case.C +++ b/apps/upper_case.C @@ -101,13 +101,12 @@ int do_checkpoint(MFILE& mf, int nchars) { if (cpu_time) { double cur_cpu; - double cur_mem; // print our own information about cpu time fprintf(app_time, "%f\n", difftime(time(0), my_start_time)); fflush(app_time); fclose(app_time); - boinc_cpu_time(cur_cpu, cur_mem); + boinc_wu_cpu_time(cur_cpu); // print what the client thinks is our cpu time fprintf(client_time, "%f\n", uc_aid.wu_cpu_time + cur_cpu); fflush(client_time); @@ -254,8 +253,7 @@ int main(int argc, char **argv) { if (random_exit) exit(-10); fprintf(stderr, "APP: upper_case ending, wrote %d chars\n", nchars); double cur_cpu; - double cur_mem; - boinc_cpu_time(cur_cpu, cur_mem); + boinc_wu_cpu_time(cur_cpu); #ifdef BOINC_APP_GRAPHICS boinc_finish_opengl();