From 2a12a8fb8bd0b922314141eb3a470e5c9f16fead Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 2 Mar 2010 01:24:03 +0000 Subject: [PATCH] - client: if suspending apps because of CPU benchmarks, leave them in memory svn path=/trunk/boinc/; revision=20765 --- checkin_notes | 9 +++++++++ client/app.h | 2 +- client/app_control.cpp | 11 ++++++++--- client/cs_prefs.cpp | 3 +-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/checkin_notes b/checkin_notes index 6c95308ded..e42c9c8693 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/client/app.h b/client/app.h index 0b54a7549a..1dc8186c0e 100644 --- a/client/app.h +++ b/client/app.h @@ -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); diff --git a/client/app_control.cpp b/client/app_control.cpp index 080baea131..0f8c88afa5 100644 --- a/client/app_control.cpp +++ b/client/app_control.cpp @@ -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; itask_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); } } diff --git a/client/cs_prefs.cpp b/client/cs_prefs.cpp index c9d92275bf..8e1d6cdf8f 100644 --- a/client/cs_prefs.cpp +++ b/client/cs_prefs.cpp @@ -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; }