client: <cpu_sched> shouldn't show suspend/resume msgs for CPU throttling

This commit is contained in:
David Anderson 2014-01-22 11:08:09 -08:00
parent 5778cd653f
commit 9d056d60cb
3 changed files with 13 additions and 12 deletions

View File

@ -139,7 +139,7 @@ ACTIVE_TASK::ACTIVE_TASK() {
// called from the CLIENT_STATE::enforce_schedule() // called from the CLIENT_STATE::enforce_schedule()
// and ACTIVE_TASK_SET::suspend_all() // 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; bool remove=false;
switch (preempt_type) { switch (preempt_type) {
@ -169,8 +169,9 @@ int ACTIVE_TASK::preempt(int preempt_type) {
break; break;
} }
bool show_msg = log_flags.cpu_sched && reason != SUSPEND_REASON_CPU_THROTTLE;
if (remove) { if (remove) {
if (log_flags.cpu_sched) { if (show_msg) {
msg_printf(result->project, MSG_INFO, msg_printf(result->project, MSG_INFO,
"[cpu_sched] Preempting %s (removed from memory)", "[cpu_sched] Preempting %s (removed from memory)",
result->name result->name
@ -178,7 +179,7 @@ int ACTIVE_TASK::preempt(int preempt_type) {
} }
return request_exit(); return request_exit();
} else { } else {
if (log_flags.cpu_sched) { if (show_msg) {
msg_printf(result->project, MSG_INFO, msg_printf(result->project, MSG_INFO,
"[cpu_sched] Preempting %s (left in memory)", "[cpu_sched] Preempting %s (left in memory)",
result->name result->name
@ -1056,7 +1057,7 @@ void* throttler(void*) {
boinc_sleep(off); boinc_sleep(off);
client_mutex.lock(); client_mutex.lock();
if (!gstate.tasks_suspended) { if (!gstate.tasks_suspended) {
gstate.active_tasks.unsuspend_all(); gstate.active_tasks.unsuspend_all(SUSPEND_REASON_CPU_THROTTLE);
} }
gstate.tasks_throttled = false; gstate.tasks_throttled = false;
client_mutex.unlock(); client_mutex.unlock();

View File

@ -229,9 +229,9 @@ struct ACTIVE_TASK {
int suspend(); int suspend();
// tell a process to stop executing (but stay in mem) // tell a process to stop executing (but stay in mem)
// Done by sending it a <suspend> message // Done by sending it a <suspend> message
int unsuspend(); int unsuspend(int reason=0);
// Undo a suspend: send a <resume> message // Undo a suspend: send a <resume> message
int preempt(int preempt_type); int preempt(int preempt_type, int reason=0);
// preempt (via suspend or quit) a running task // preempt (via suspend or quit) a running task
int resume_or_start(bool); int resume_or_start(bool);
void send_network_available(); void send_network_available();
@ -279,7 +279,7 @@ public:
void init(); void init();
bool poll(); bool poll();
void suspend_all(int reason); void suspend_all(int reason);
void unsuspend_all(); void unsuspend_all(int reason=0);
bool is_task_executing(); bool is_task_executing();
void request_tasks_exit(PROJECT* p=0); void request_tasks_exit(PROJECT* p=0);
int wait_for_exit(double, PROJECT* p=0); int wait_for_exit(double, PROJECT* p=0);

View File

@ -1077,7 +1077,7 @@ void ACTIVE_TASK_SET::suspend_all(int reason) {
// //
if (reason == SUSPEND_REASON_CPU_THROTTLE) { if (reason == SUSPEND_REASON_CPU_THROTTLE) {
if (atp->result->dont_throttle()) continue; if (atp->result->dont_throttle()) continue;
atp->preempt(REMOVE_NEVER); atp->preempt(REMOVE_NEVER, reason);
continue; continue;
} }
@ -1122,7 +1122,7 @@ void ACTIVE_TASK_SET::suspend_all(int reason) {
// resume all currently scheduled tasks // resume all currently scheduled tasks
// //
void ACTIVE_TASK_SET::unsuspend_all() { void ACTIVE_TASK_SET::unsuspend_all(int reason) {
unsigned int i; unsigned int i;
ACTIVE_TASK* atp; ACTIVE_TASK* atp;
for (i=0; i<active_tasks.size(); i++) { for (i=0; i<active_tasks.size(); i++) {
@ -1135,7 +1135,7 @@ void ACTIVE_TASK_SET::unsuspend_all() {
); );
} }
} else if (atp->task_state() == PROCESS_SUSPENDED) { } else if (atp->task_state() == PROCESS_SUSPENDED) {
atp->unsuspend(); atp->unsuspend(reason);
} }
} }
} }
@ -1209,14 +1209,14 @@ int ACTIVE_TASK::suspend() {
// resume a suspended task // resume a suspended task
// //
int ACTIVE_TASK::unsuspend() { int ACTIVE_TASK::unsuspend(int reason) {
if (!app_client_shm.shm) return 0; if (!app_client_shm.shm) return 0;
if (task_state() != PROCESS_SUSPENDED) { if (task_state() != PROCESS_SUSPENDED) {
msg_printf(result->project, MSG_INFO, msg_printf(result->project, MSG_INFO,
"Internal error: expected process %s to be suspended", result->name "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, msg_printf(result->project, MSG_INFO,
"[cpu_sched] Resuming %s", result->name "[cpu_sched] Resuming %s", result->name
); );