From 28bc319055fa9933a6c16fc54b092c93fb8e59e0 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 21 Jan 2009 20:28:00 +0000 Subject: [PATCH] - client: fetch work from non-CPU-intensive projects svn path=/trunk/boinc/; revision=16969 --- checkin_notes | 6 ++++++ client/work_fetch.cpp | 27 +++++++++++++++++++++++++++ client/work_fetch.h | 1 + 3 files changed, 34 insertions(+) diff --git a/checkin_notes b/checkin_notes index 212195c918..1ac4fcb24e 100644 --- a/checkin_notes +++ b/checkin_notes @@ -532,3 +532,9 @@ David 21 Jan 2009 sched/ sched_plan.cpp + +David 21 Jan 2009 + - client: fetch work from non-CPU-intensive projects + + client/ + work_fetch.cpp,h diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index 313c3930cc..9e3542d426 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -207,12 +207,39 @@ void WORK_FETCH::compute_work_request(PROJECT* p) { clear_request(); } +// see if there's a fetchable non-CPU-intensive project without work +// +PROJECT* WORK_FETCH::non_cpu_intensive_project_needing_work() { + for (unsigned int i=0; inon_cpu_intensive) continue; + if (!p->can_request_work()) continue; + bool has_work = false; + for (unsigned int j=0; jproject == p) { + has_work = true; + break; + } + } + if (!has_work) { + clear_request(); + cpu_work_fetch.req_secs = 1; + return p; + } + } + return 0; +} + // choose a project to fetch work from, // and set the request fields of resource objects // PROJECT* WORK_FETCH::choose_project() { PROJECT* p = 0; + p = non_cpu_intensive_project_needing_work(); + if (p) return p; + gstate.adjust_debts(); gstate.compute_nuploading_results(); diff --git a/client/work_fetch.h b/client/work_fetch.h index 87cc0b18bd..1ff2d80e11 100644 --- a/client/work_fetch.h +++ b/client/work_fetch.h @@ -126,6 +126,7 @@ struct WORK_FETCH { void set_overall_debts(); PROJECT* choose_project(); // find a project to ask for work + PROJECT* WORK_FETCH::non_cpu_intensive_project_needing_work(); void compute_work_request(PROJECT*); // we're going to contact this project anyway; // decide how much work to task for