mirror of https://github.com/BOINC/boinc.git
API, Unix: call getrusage() from inside boinc_worker_thread_cpu_time() and make worker_thread_ru a local stack variable to avoid potential problems with thread preemption.
svn path=/trunk/boinc/; revision=13880
This commit is contained in:
parent
c70f01b64d
commit
2ed89c4c65
|
@ -140,7 +140,6 @@ HANDLE worker_thread_handle;
|
|||
// used to suspend worker thread, and to measure its CPU time
|
||||
#else
|
||||
static pthread_t timer_thread_handle;
|
||||
static struct rusage worker_thread_ru;
|
||||
#endif
|
||||
|
||||
static BOINC_OPTIONS options;
|
||||
|
@ -206,6 +205,9 @@ double boinc_worker_thread_cpu_time() {
|
|||
cpu = nrunning_ticks * TIMER_PERIOD; // for Win9x
|
||||
}
|
||||
#else
|
||||
struct rusage worker_thread_ru;
|
||||
|
||||
getrusage(RUSAGE_SELF, &worker_thread_ru);
|
||||
cpu = (double)worker_thread_ru.ru_utime.tv_sec
|
||||
+ (((double)worker_thread_ru.ru_utime.tv_usec)/1000000.0);
|
||||
cpu += (double)worker_thread_ru.ru_stime.tv_sec
|
||||
|
@ -931,7 +933,6 @@ void* timer_thread(void*) {
|
|||
block_sigalrm();
|
||||
while(1) {
|
||||
boinc_sleep(TIMER_PERIOD);
|
||||
getrusage(RUSAGE_SELF, &worker_thread_ru);
|
||||
timer_handler();
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -9607,4 +9607,11 @@ Charlie 16 Oct 2007
|
|||
setupForBOINC.sh
|
||||
boinc.xcodeproj/
|
||||
project.pbxproj
|
||||
|
||||
|
||||
Charlie 16 Oct 2007
|
||||
- API, Unix: call getrusage() from inside boinc_worker_thread_cpu_time()
|
||||
and make worker_thread_ru a local stack variable to avoid potential
|
||||
problems with thread preemption.
|
||||
|
||||
api/
|
||||
boinc_api.C
|
||||
|
|
Loading…
Reference in New Issue