mirror of https://github.com/BOINC/boinc.git
- scheduler: reduce frequency of calls to work_needed()
svn path=/trunk/boinc/; revision=17003
This commit is contained in:
parent
7d1038f940
commit
4cd3c530b0
|
@ -680,3 +680,10 @@ David 23 Jan 2009
|
|||
|
||||
api/
|
||||
boinc_api.cpp
|
||||
|
||||
David 23 Jan 2009
|
||||
- scheduler: reduce frequency of calls to work_needed()
|
||||
|
||||
sched/
|
||||
sched_array.cpp
|
||||
sched_send.app
|
||||
|
|
|
@ -58,12 +58,13 @@ void scan_work_array() {
|
|||
char buf[256];
|
||||
APP* app;
|
||||
|
||||
if (!work_needed(false)) return;
|
||||
|
||||
lock_sema();
|
||||
|
||||
rnd_off = rand() % ssp->max_wu_results;
|
||||
for (j=0; j<ssp->max_wu_results; j++) {
|
||||
i = (j+rnd_off) % ssp->max_wu_results;
|
||||
if (!work_needed(false)) break;
|
||||
|
||||
WU_RESULT& wu_result = ssp->wu_results[i];
|
||||
|
||||
|
@ -294,6 +295,7 @@ dont_send:
|
|||
wu_result.state = WR_STATE_PRESENT;
|
||||
done:
|
||||
lock_sema();
|
||||
if (!work_needed(false)) break;
|
||||
}
|
||||
unlock_sema();
|
||||
}
|
||||
|
|
|
@ -1022,12 +1022,31 @@ bool work_needed(bool locality_sched) {
|
|||
}
|
||||
if (g_wreq->nresults >= config.max_wus_to_send) return false;
|
||||
|
||||
#if 0
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"work_needed: spec req %d sec to fill %.2f; CPU (%.2f, %.2f) CUDA (%.2f, %.2f)\n",
|
||||
g_wreq->rsc_spec_request,
|
||||
g_wreq->seconds_to_fill,
|
||||
g_wreq->cpu_req_secs, g_wreq->cpu_req_instances,
|
||||
g_wreq->cuda_req_secs, g_wreq->cuda_req_instances
|
||||
);
|
||||
#endif
|
||||
if (g_wreq->rsc_spec_request) {
|
||||
if (g_wreq->need_cpu()) return true;
|
||||
if (g_wreq->need_cuda()) return true;
|
||||
if (g_wreq->need_cpu()) {
|
||||
//log_messages.printf(MSG_NORMAL, "need CPU\n");
|
||||
return true;
|
||||
}
|
||||
if (g_wreq->need_cuda()) {
|
||||
//log_messages.printf(MSG_NORMAL, "need CUDA\n");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (g_wreq->seconds_to_fill > 0) return true;
|
||||
if (g_wreq->seconds_to_fill > 0) {
|
||||
//log_messages.printf(MSG_NORMAL, "need old CPU\n");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//log_messages.printf(MSG_NORMAL, "don't need\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue