mirror of https://github.com/BOINC/boinc.git
- 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:
parent
2d40b5722d
commit
4680b446ce
|
@ -134,8 +134,10 @@ HANDLE worker_thread_handle;
|
||||||
// used to suspend worker thread, and to measure its CPU time
|
// used to suspend worker thread, and to measure its CPU time
|
||||||
#else
|
#else
|
||||||
static pthread_t timer_thread_handle;
|
static pthread_t timer_thread_handle;
|
||||||
|
#ifndef __APPLE__
|
||||||
static struct rusage worker_thread_ru;
|
static struct rusage worker_thread_ru;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
static BOINC_OPTIONS options;
|
static BOINC_OPTIONS options;
|
||||||
static volatile BOINC_STATUS boinc_status;
|
static volatile BOINC_STATUS boinc_status;
|
||||||
|
@ -200,6 +202,10 @@ double boinc_worker_thread_cpu_time() {
|
||||||
cpu = nrunning_ticks * TIMER_PERIOD; // for Win9x
|
cpu = nrunning_ticks * TIMER_PERIOD; // for Win9x
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
#ifdef __APPLE__
|
||||||
|
struct rusage worker_thread_ru;
|
||||||
|
getrusage(RUSAGE_SELF, &worker_thread_ru);
|
||||||
|
#endif
|
||||||
cpu = (double)worker_thread_ru.ru_utime.tv_sec
|
cpu = (double)worker_thread_ru.ru_utime.tv_sec
|
||||||
+ (((double)worker_thread_ru.ru_utime.tv_usec)/1000000.0);
|
+ (((double)worker_thread_ru.ru_utime.tv_usec)/1000000.0);
|
||||||
cpu += (double)worker_thread_ru.ru_stime.tv_sec
|
cpu += (double)worker_thread_ru.ru_stime.tv_sec
|
||||||
|
@ -891,7 +897,9 @@ void* timer_thread(void*) {
|
||||||
block_sigalrm();
|
block_sigalrm();
|
||||||
while(1) {
|
while(1) {
|
||||||
boinc_sleep(TIMER_PERIOD);
|
boinc_sleep(TIMER_PERIOD);
|
||||||
|
#ifndef __APPLE__
|
||||||
getrusage(RUSAGE_SELF, &worker_thread_ru);
|
getrusage(RUSAGE_SELF, &worker_thread_ru);
|
||||||
|
#endif
|
||||||
timer_handler();
|
timer_handler();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -76,3 +76,15 @@ David Jan 3 2008
|
||||||
|
|
||||||
html/inc/
|
html/inc/
|
||||||
profile.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
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! /usr/local/bin/perl
|
#! /usr/bin/env/perl
|
||||||
|
|
||||||
# The contents of this file are subject to the Mozilla Public License
|
# 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
|
# Version 1.0 (the "License"); you may not use this file except in
|
||||||
|
|
Loading…
Reference in New Issue