From 4680b446cee5f7fceccc0157a1eb61a88d94dd74 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 3 Jan 2008 20:43:48 +0000 Subject: [PATCH] - 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 --- api/boinc_api.C | 8 ++++++++ checkin_notes | 12 ++++++++++++ stripchart/stripchart | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/api/boinc_api.C b/api/boinc_api.C index c30ce4d765..477caf875d 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -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; diff --git a/checkin_notes b/checkin_notes index 24aaa5674a..24ed2938cd 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/stripchart/stripchart b/stripchart/stripchart index b5e3535950..e32a0199fa 100755 --- a/stripchart/stripchart +++ b/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 # Version 1.0 (the "License"); you may not use this file except in