- client: if suspending apps because of CPU benchmarks,

leave them in memory

svn path=/trunk/boinc/; revision=20765
This commit is contained in:
David Anderson 2010-03-02 01:24:03 +00:00
parent 2a5248cf39
commit 2a12a8fb8b
4 changed files with 19 additions and 6 deletions

View File

@ -1481,3 +1481,12 @@ Rom 1 Mar 2010
hostinfo_win.cpp
lib/
str_util.h
David 1 Mar 2010
- client: if suspending apps because of CPU benchmarks,
leave them in memory
client/
app.h
app_control.cpp
cs_prefs.cpp

View File

@ -238,7 +238,7 @@ public:
ACTIVE_TASK* lookup_result(RESULT*);
void init();
bool poll();
void suspend_all(bool leave_apps_in_memory=true);
void suspend_all(int reason);
void unsuspend_all();
bool is_task_executing();
void request_tasks_exit(PROJECT* p=0);

View File

@ -807,18 +807,23 @@ int ACTIVE_TASK_SET::abort_project(PROJECT* project) {
// called only from CLIENT_STATE::suspend_tasks(),
// e.g. because on batteries, time of day, benchmarking, CPU throttle, etc.
//
void ACTIVE_TASK_SET::suspend_all(bool cpu_throttle) {
void ACTIVE_TASK_SET::suspend_all(int reason) {
for (unsigned int i=0; i<active_tasks.size(); i++) {
ACTIVE_TASK* atp = active_tasks[i];
if (atp->task_state() != PROCESS_EXECUTING) continue;
if (cpu_throttle) {
switch (reason) {
case SUSPEND_REASON_CPU_USAGE_LIMIT:
// if we're doing CPU throttling, don't bother suspending apps
// that don't use a full CPU
//
if (atp->result->project->non_cpu_intensive) continue;
if (atp->app_version->avg_ncpus < 1) continue;
atp->preempt(REMOVE_NEVER);
} else {
break;
case SUSPEND_REASON_BENCHMARKS:
atp->preempt(REMOVE_NEVER);
break;
default:
atp->preempt(REMOVE_MAYBE_USER);
}
}

View File

@ -203,11 +203,10 @@ int CLIENT_STATE::suspend_tasks(int reason) {
if (log_flags.cpu_sched) {
msg_printf(NULL, MSG_INFO, "[cpu_sched] Suspending - CPU throttle");
}
active_tasks.suspend_all(true);
} else {
print_suspend_tasks_message(reason);
active_tasks.suspend_all(false);
}
active_tasks.suspend_all(reason);
return 0;
}