Mac: don't include graphics apps in non-BOINC CPU time; optimize screensaver for OS 10.6.

svn path=/trunk/boinc/; revision=21132
This commit is contained in:
Charlie Fenton 2010-04-07 11:37:56 +00:00
parent 84861e7c55
commit 8e7f5082e2
4 changed files with 41 additions and 35 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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;

View File

@ -125,22 +125,22 @@ int procinfo_setup(vector<PROCINFO>& 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<PROCINFO>& piv, int pid, int rlvl) {
void add_proc_totals(PROCINFO& pi, vector<PROCINFO>& 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.size(); i++) {
PROCINFO& p = piv[i];
if (p.parentid == pid) {
if (p.id == pid || p.parentid == pid) {
// pi.kernel_time += p.kernel_time;
pi.user_time += p.user_time;
pi.swap_size += p.swap_size;
pi.working_set_size += p.working_set_size;
p.is_boinc_app = true;
// look for child process of this one
add_child_totals(pi, piv, p.id, rlvl+1); // recursion - woo hoo!
add_proc_totals(pi, piv, p.id, graphics_exec_file, i+1, rlvl+1); // recursion - woo hoo!
}
}
}
@ -148,22 +148,8 @@ void add_child_totals(PROCINFO& pi, vector<PROCINFO>& 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<PROCINFO>& piv) {
unsigned int i;
for (i=0; i<piv.size(); i++) {
PROCINFO& p = piv[i];
if (p.id == pi.id) {
// pi.kernel_time += p.kernel_time;
pi.user_time += p.user_time;
pi.swap_size += p.swap_size;
pi.working_set_size += p.working_set_size;
p.is_boinc_app = true;
// look for child processes
add_child_totals(pi, piv, pi.id, 0);
return;
}
}
void procinfo_app(PROCINFO& pi, vector<PROCINFO>& piv, char* graphics_exec_file) {
add_proc_totals(pi, piv, pi.id, graphics_exec_file, 0, 0);
}
void procinfo_other(PROCINFO& pi, vector<PROCINFO>& piv) {