From 7001c6f7c539a708755094db2ab348b4f5ce0eb4 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 22 Feb 2009 15:40:44 +0000 Subject: [PATCH] - client: tweak the LTD calculation so that the largest debt always tends towards zero svn path=/trunk/boinc/; revision=17333 --- checkin_notes | 7 +++++++ client/work_fetch.cpp | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/checkin_notes b/checkin_notes index 807ce41d89..76963e01c1 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1870,3 +1870,10 @@ David 20 Feb 2009 lib/ coproc.h boinc_fcgi.cpp,h + +David 21 Feb 2009 + - client: tweak the LTD calculation so that the largest debt + always tends towards zero + + client/ + work_fetch.cpp diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index eddff15f49..eb1d493bda 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -527,12 +527,19 @@ void RSC_WORK_FETCH::update_debts() { // also, if all the debts are large negative we need to gradually // shift them towards zero. // To do this, we add an offset as follows: + // delta_limit is the largest rate at which any project's debt + // could increase or decrease. + // If the largest debt is close to zero (relative to delta_limit) + // than add an offset that will bring it exactly to zero. + // Otherwise add an offset of 2*delta_limit, + // which will gradually bring all the debts towards zero // double offset; - if (-max_debt < secs_this_debt_interval) { + double delta_limit = secs_this_debt_interval*ninstances; + if (-max_debt < 2*delta_limit) { offset = -max_debt; } else { - offset = secs_this_debt_interval; + offset = 2*delta_limit; } if (log_flags.debt_debug) { msg_printf(0, MSG_INFO, "[debt] %s debt: adding offset %.2f",