- API: on Mac, call getrusage() from timer thread

(since calling it from worker thread causes crashes).
    On Linux, call getrusage() from the worker thread
    (since calling it from the timer thread returns zero on some systems).
- stripcharts: make it work even if Perl is not in path (from Eric Myers)

svn path=/trunk/boinc/; revision=14462
This commit is contained in:
David Anderson 2008-01-03 20:43:48 +00:00
parent 2d40b5722d
commit 4680b446ce
3 changed files with 21 additions and 1 deletions

View File

@ -134,8 +134,10 @@ HANDLE worker_thread_handle;
// used to suspend worker thread, and to measure its CPU time
#else
static pthread_t timer_thread_handle;
#ifndef __APPLE__
static struct rusage worker_thread_ru;
#endif
#endif
static BOINC_OPTIONS options;
static volatile BOINC_STATUS boinc_status;
@ -200,6 +202,10 @@ double boinc_worker_thread_cpu_time() {
cpu = nrunning_ticks * TIMER_PERIOD; // for Win9x
}
#else
#ifdef __APPLE__
struct rusage worker_thread_ru;
getrusage(RUSAGE_SELF, &worker_thread_ru);
#endif
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
@ -891,7 +897,9 @@ void* timer_thread(void*) {
block_sigalrm();
while(1) {
boinc_sleep(TIMER_PERIOD);
#ifndef __APPLE__
getrusage(RUSAGE_SELF, &worker_thread_ru);
#endif
timer_handler();
}
return 0;

View File

@ -76,3 +76,15 @@ David Jan 3 2008
html/inc/
profile.inc
David Jan 3 2008
- API: on Mac, call getrusage() from timer thread
(since calling it from worker thread causes crashes).
On Linux, call getrusage() from the worker thread
(since calling it from the timer thread returns zero on some systems).
- stripcharts: make it work even if Perl is not in path (from Eric Myers)
api/
boinc_api.C
stripchart/
stripchart

View File

@ -1,4 +1,4 @@
#! /usr/local/bin/perl
#! /usr/bin/env/perl
# The contents of this file are subject to the Mozilla Public License
# Version 1.0 (the "License"); you may not use this file except in