diff --git a/checkin_notes b/checkin_notes
index f4adc9294d..dc64bba6c3 100755
--- a/checkin_notes
+++ b/checkin_notes
@@ -8317,3 +8317,23 @@ Charlie 1 Aug 2006
mac_build/
boinc.xcodeproj/
project.pbxproj
+
+David 2 Aug 2006
+ - core client: fix CPU throttling mechanism.
+ - Range is 0..100, not 0..1
+ - ACTIVE_TASK::prempt(): don't set scheduler_state
+ (that's not the job of this layer)
+ - core client: fiddle with messages
+ "task" should show you when results start and end
+ (always 2 messages per result)
+ "task_debug" shows every suspend/resume/checkpoint
+ "cpu_sched_debug" shows the results selected by scheduler
+ (more fiddling still needed)
+
+ client/
+ app_control.C
+ app_start.C
+ cpu_sched.C
+ cs_prefs.C
+ lib/
+ prefs.C
diff --git a/client/app_control.C b/client/app_control.C
index edae5779ac..0cf487fee0 100644
--- a/client/app_control.C
+++ b/client/app_control.C
@@ -152,9 +152,7 @@ int ACTIVE_TASK::preempt(bool quit_task) {
retval = suspend();
}
- scheduler_state = CPU_SCHED_PREEMPTED;
-
- if (log_flags.task) {
+ if (log_flags.task_debug) {
msg_printf(result->project, MSG_INFO,
"Pausing task %s (%s)",
result->name, (quit_task ? "removed from memory" : "left in memory")
@@ -837,6 +835,9 @@ int ACTIVE_TASK::suspend() {
//
int ACTIVE_TASK::unsuspend() {
if (!app_client_shm.shm) return 0;
+ if (log_flags.task_debug) {
+ msg_printf(0, MSG_INFO, "Resuming %s", result->name);
+ }
process_control_queue.msg_queue_send(
"",
app_client_shm.shm->process_control_request
diff --git a/client/app_start.C b/client/app_start.C
index d6cce6f47a..dd25f88e20 100644
--- a/client/app_start.C
+++ b/client/app_start.C
@@ -313,9 +313,14 @@ int ACTIVE_TASK::start(bool first_time) {
std::string cmd_line;
#endif
+ if (first_time && log_flags.task) {
+ msg_printf(0, MSG_INFO,
+ "Starting %s", result->name
+ );
+ }
if (log_flags.task_debug) {
msg_printf(0, MSG_INFO,
- "ACTIVE_TASK::start(first_time=%d)\n", first_time
+ "Starting %s%s", result->name, first_time?" (first time)":""
);
}
diff --git a/client/cpu_sched.C b/client/cpu_sched.C
index cf5e92182b..dcf453f63b 100644
--- a/client/cpu_sched.C
+++ b/client/cpu_sched.C
@@ -442,6 +442,9 @@ void CLIENT_STATE::schedule_cpus() {
rp->already_selected = true;
rp->project->anticipated_debt -= (1 - rp->project->resource_share / rrs) * expected_pay_off;
rp->project->deadlines_missed--;
+ if (log_flags.cpu_sched_debug) {
+ msg_printf(NULL, MSG_INFO, "scheduling (deadline) %s", rp->name);
+ }
ordered_scheduled_results.push_back(rp);
}
@@ -452,6 +455,9 @@ void CLIENT_STATE::schedule_cpus() {
rp = largest_debt_project_best_result();
if (!rp) break;
rp->project->anticipated_debt -= (1 - rp->project->resource_share / rrs) * expected_pay_off;
+ if (log_flags.cpu_sched_debug) {
+ msg_printf(NULL, MSG_INFO, "scheduling (regular) %s", rp->name);
+ }
ordered_scheduled_results.push_back(rp);
}
diff --git a/client/cs_prefs.C b/client/cs_prefs.C
index 2a983b87a7..7e23299ab5 100644
--- a/client/cs_prefs.C
+++ b/client/cs_prefs.C
@@ -208,9 +208,7 @@ static string reason_string(int reason) {
int CLIENT_STATE::suspend_tasks(int reason) {
if (reason == SUSPEND_REASON_CPU_USAGE_LIMIT) {
if (log_flags.cpu_sched) {
- string s_reason;
- s_reason = "Suspending computation" + reason_string(reason);
- msg_printf(NULL, MSG_INFO, s_reason.c_str());
+ msg_printf(NULL, MSG_INFO, "Suspending - CPU throttle");
}
active_tasks.suspend_all(true);
} else {
@@ -224,8 +222,10 @@ int CLIENT_STATE::suspend_tasks(int reason) {
int CLIENT_STATE::resume_tasks(int reason) {
if (reason == SUSPEND_REASON_CPU_USAGE_LIMIT) {
+ if (log_flags.cpu_sched) {
+ msg_printf(NULL, MSG_INFO, "Resuming - CPU throttle");
+ }
active_tasks.unsuspend_all();
- gstate.request_schedule_cpus("usage limit");
} else {
msg_printf(NULL, MSG_INFO, "Resuming computation");
active_tasks.unsuspend_all();
diff --git a/lib/prefs.C b/lib/prefs.C
index a3af60ffa2..bf661e2a18 100644
--- a/lib/prefs.C
+++ b/lib/prefs.C
@@ -212,7 +212,7 @@ int GLOBAL_PREFS::parse_override(
} else if (parse_int(buf, "", cpu_affinity)) {
continue;
} else if (parse_double(buf, "", dtemp)) {
- if (dtemp > 0 && dtemp <= 1) {
+ if (dtemp > 0 && dtemp <= 100) {
cpu_usage_limit = dtemp;
}
continue;