From 8e7f5082e28770069db3aec4f73e896ea2b1dc56 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Wed, 7 Apr 2010 11:37:56 +0000 Subject: [PATCH] Mac: don't include graphics apps in non-BOINC CPU time; optimize screensaver for OS 10.6. svn path=/trunk/boinc/; revision=21132 --- checkin_notes | 12 +++++++++++ clientscr/Mac_Saver_ModuleView.m | 2 ++ clientscr/screensaver.cpp | 36 +++++++++++++++++++------------- lib/procinfo_mac.cpp | 26 ++++++----------------- 4 files changed, 41 insertions(+), 35 deletions(-) diff --git a/checkin_notes b/checkin_notes index 617ab0ab1d..40428ade3a 100644 --- a/checkin_notes +++ b/checkin_notes @@ -2572,3 +2572,15 @@ David 6 Apr 2010 lib/ procinfo.h procinfo_win.cpp + +Charlie 7 Apr 2010 + - Mac SS: Optimize screensaver for OS 10.6. + - client: don't include graphics apps in non-BOINC CPU time (Mac). + + clientscr/ + Mac_Saver_ModuleView.m + screensaver.cpp + lib/ + procinfo_mac.cpp + + diff --git a/clientscr/Mac_Saver_ModuleView.m b/clientscr/Mac_Saver_ModuleView.m index d5b6a40e7c..9b9a112dc2 100644 --- a/clientscr/Mac_Saver_ModuleView.m +++ b/clientscr/Mac_Saver_ModuleView.m @@ -252,6 +252,8 @@ int signof(float x) { // Hide window on second display to aid in debugging #ifdef _DEBUG [ myWindow setLevel:kCGMinimumWindowLevel ]; + NSInteger alpha = 0; + [ myWindow setAlphaValue:alpha ]; // For OS 10.6 #endif return; // We draw only to main screen } diff --git a/clientscr/screensaver.cpp b/clientscr/screensaver.cpp index 3f0e03bc14..46476864e2 100644 --- a/clientscr/screensaver.cpp +++ b/clientscr/screensaver.cpp @@ -632,9 +632,11 @@ void *CScreensaver::DataManagementProc() // Core client suspended? if (suspend_reason && !(suspend_reason & SUSPEND_REASON_CPU_THROTTLE)) { - SetError(TRUE, m_hrError); // No GFX App is running: show moving BOINC logo - if (m_bDefault_ss_exists && !m_bDefault_gfx_running) { - switch_to_default_gfx = true; + if (!m_bDefault_gfx_running) { + SetError(TRUE, m_hrError); // No GFX App is running: show moving BOINC logo + if (m_bDefault_ss_exists) { + switch_to_default_gfx = true; + } } } @@ -666,7 +668,7 @@ void *CScreensaver::DataManagementProc() if (ss_phase == SCIENCE_SS_PHASE) { default_saver_start_time_in_science_phase = dtime(); } - SetError(FALSE, m_hrError); // A GFX App is running: hide moving BOINC logo + SetError(FALSE, SCRAPPERR_BOINCSCREENSAVERLOADING); // A GFX App is running: hide moving BOINC logo } } } @@ -676,10 +678,12 @@ void *CScreensaver::DataManagementProc() #if SIMULATE_NO_GRAPHICS /* FOR TESTING */ - SetError(TRUE, m_hrError); // No GFX App is running: show moving BOINC logo - if (m_bDefault_ss_exists && !m_bDefault_gfx_running) { - switch_to_default_gfx = true; - } + if (!m_bDefault_gfx_running) { + SetError(TRUE, m_hrError); // No GFX App is running: show moving BOINC logo + if (m_bDefault_ss_exists) { + switch_to_default_gfx = true; + } + } #else /* NORMAL OPERATION */ @@ -766,7 +770,7 @@ void *CScreensaver::DataManagementProc() graphics_app_result_ptr = NULL; m_bScience_gfx_running = false; } else { - SetError(FALSE, m_hrError); // A GFX App is running: hide moving BOINC logo + SetError(FALSE, SCRAPPERR_BOINCSCREENSAVERLOADING); // A GFX App is running: hide moving BOINC logo last_change_time = dtime(); m_bScience_gfx_running = true; // Make a local copy of current result, since original pointer @@ -781,10 +785,12 @@ void *CScreensaver::DataManagementProc() } } } else { - SetError(TRUE, m_hrError); // No GFX App is running: show moving BOINC logo - // We can't run a science graphics app, so run the default graphics if available - if (m_bDefault_ss_exists && !m_bDefault_gfx_running) { - switch_to_default_gfx = true; + if (!m_bDefault_gfx_running) { + // We can't run a science graphics app, so run the default graphics if available + SetError(TRUE, m_hrError); + if (m_bDefault_ss_exists) { + switch_to_default_gfx = true; + } } } // End if no science graphics available @@ -805,7 +811,7 @@ void *CScreensaver::DataManagementProc() } else { m_bDefault_gfx_running = true; default_saver_start_time_in_science_phase = dtime(); - SetError(FALSE, m_hrError); // A GFX App is running: hide moving BOINC logo + SetError(FALSE, SCRAPPERR_BOINCSCREENSAVERLOADING); // Default GFX App is running: hide moving BOINC logo } } } @@ -833,7 +839,7 @@ void *CScreensaver::DataManagementProc() } killing_default_gfx = false; } - SetError(TRUE, m_hrError); // No GFX App is running: show moving BOINC logo + SetError(TRUE, SCRAPPERR_BOINCNOGRAPHICSAPPSEXECUTING); // No GFX App is running: show moving BOINC logo m_hGraphicsApplication = 0; graphics_app_result_ptr = NULL; m_bDefault_gfx_running = false; diff --git a/lib/procinfo_mac.cpp b/lib/procinfo_mac.cpp index 54da06fa89..c928ae55dd 100644 --- a/lib/procinfo_mac.cpp +++ b/lib/procinfo_mac.cpp @@ -125,22 +125,22 @@ int procinfo_setup(vector& pi) { // thru entire table as the entries aren't in order. Recurse at // most 4 times to get additional child processes // -void add_child_totals(PROCINFO& pi, vector& piv, int pid, int rlvl) { +void add_proc_totals(PROCINFO& pi, vector& piv, int pid, char* graphics_exec_file, int start, int rlvl) { unsigned int i; - if (rlvl > 3) { + if (rlvl > 4) { return; } for (i=0; i& piv, int pid, int rlvl) { // fill in the given PROCINFO (which initially is zero except for id) // with totals from that process and all its descendants // -void procinfo_app(PROCINFO& pi, vector& piv) { - unsigned int i; - - for (i=0; i& piv, char* graphics_exec_file) { + add_proc_totals(pi, piv, pi.id, graphics_exec_file, 0, 0); } void procinfo_other(PROCINFO& pi, vector& piv) {