fixed UNIX compile problems

svn path=/trunk/boinc/; revision=2638
This commit is contained in:
Eric Heien 2003-11-07 01:46:38 +00:00
parent b2cb30ea11
commit f35f7aa5a9
2 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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();