diff --git a/client/app.cpp b/client/app.cpp index bdd15ad755..dc1623fc35 100644 --- a/client/app.cpp +++ b/client/app.cpp @@ -139,7 +139,7 @@ ACTIVE_TASK::ACTIVE_TASK() { // called from the CLIENT_STATE::enforce_schedule() // and ACTIVE_TASK_SET::suspend_all() // -int ACTIVE_TASK::preempt(int preempt_type) { +int ACTIVE_TASK::preempt(int preempt_type, int reason) { bool remove=false; switch (preempt_type) { @@ -169,8 +169,9 @@ int ACTIVE_TASK::preempt(int preempt_type) { break; } + bool show_msg = log_flags.cpu_sched && reason != SUSPEND_REASON_CPU_THROTTLE; if (remove) { - if (log_flags.cpu_sched) { + if (show_msg) { msg_printf(result->project, MSG_INFO, "[cpu_sched] Preempting %s (removed from memory)", result->name @@ -178,7 +179,7 @@ int ACTIVE_TASK::preempt(int preempt_type) { } return request_exit(); } else { - if (log_flags.cpu_sched) { + if (show_msg) { msg_printf(result->project, MSG_INFO, "[cpu_sched] Preempting %s (left in memory)", result->name @@ -1056,7 +1057,7 @@ void* throttler(void*) { boinc_sleep(off); client_mutex.lock(); if (!gstate.tasks_suspended) { - gstate.active_tasks.unsuspend_all(); + gstate.active_tasks.unsuspend_all(SUSPEND_REASON_CPU_THROTTLE); } gstate.tasks_throttled = false; client_mutex.unlock(); diff --git a/client/app.h b/client/app.h index 7941357a75..cad737163f 100644 --- a/client/app.h +++ b/client/app.h @@ -229,9 +229,9 @@ struct ACTIVE_TASK { int suspend(); // tell a process to stop executing (but stay in mem) // Done by sending it a message - int unsuspend(); + int unsuspend(int reason=0); // Undo a suspend: send a message - int preempt(int preempt_type); + int preempt(int preempt_type, int reason=0); // preempt (via suspend or quit) a running task int resume_or_start(bool); void send_network_available(); @@ -279,7 +279,7 @@ public: void init(); bool poll(); void suspend_all(int reason); - void unsuspend_all(); + void unsuspend_all(int reason=0); bool is_task_executing(); void request_tasks_exit(PROJECT* p=0); int wait_for_exit(double, PROJECT* p=0); diff --git a/client/app_control.cpp b/client/app_control.cpp index ef63195b01..fae147168e 100644 --- a/client/app_control.cpp +++ b/client/app_control.cpp @@ -1077,7 +1077,7 @@ void ACTIVE_TASK_SET::suspend_all(int reason) { // if (reason == SUSPEND_REASON_CPU_THROTTLE) { if (atp->result->dont_throttle()) continue; - atp->preempt(REMOVE_NEVER); + atp->preempt(REMOVE_NEVER, reason); continue; } @@ -1122,7 +1122,7 @@ void ACTIVE_TASK_SET::suspend_all(int reason) { // resume all currently scheduled tasks // -void ACTIVE_TASK_SET::unsuspend_all() { +void ACTIVE_TASK_SET::unsuspend_all(int reason) { unsigned int i; ACTIVE_TASK* atp; for (i=0; itask_state() == PROCESS_SUSPENDED) { - atp->unsuspend(); + atp->unsuspend(reason); } } } @@ -1209,14 +1209,14 @@ int ACTIVE_TASK::suspend() { // resume a suspended task // -int ACTIVE_TASK::unsuspend() { +int ACTIVE_TASK::unsuspend(int reason) { if (!app_client_shm.shm) return 0; if (task_state() != PROCESS_SUSPENDED) { msg_printf(result->project, MSG_INFO, "Internal error: expected process %s to be suspended", result->name ); } - if (log_flags.cpu_sched) { + if (log_flags.cpu_sched && reason != SUSPEND_REASON_CPU_THROTTLE) { msg_printf(result->project, MSG_INFO, "[cpu_sched] Resuming %s", result->name );