From a412f79441659722a3bd7b6ab5d32da54b941055 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 31 Jan 2006 00:02:31 +0000 Subject: [PATCH] LTD fix svn path=/trunk/boinc/; revision=9351 --- checkin_notes | 7 +++++++ client/client_types.C | 7 +++++++ client/client_types.h | 2 ++ client/cs_apps.C | 6 +++--- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/checkin_notes b/checkin_notes index c654b7a5cd..f039f5d6b8 100755 --- a/checkin_notes +++ b/checkin_notes @@ -1174,3 +1174,10 @@ Rom 30 Jan 2006 clientgui/ BOINCBaseView.cpp BOINCListCtrl.cpp + +David 30 Jan 2006 + - fixes for LTD calculation (from James Drews) + + client/ + client_types.C,h + cs_apps.C diff --git a/client/client_types.C b/client/client_types.C index 6c3927fe90..507f8aa288 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -421,6 +421,13 @@ bool PROJECT::potentially_runnable() { return false; } +bool PROJECT::debt_adjust_allowed() { + if (non_cpu_intensive) return false; + if (suspended_via_gui) return false; + if (dont_request_more_work && !runnable()) return false; + return true; +} + double PROJECT::next_file_xfer_time(const bool is_upload) { return (is_upload ? next_file_xfer_up : next_file_xfer_down); } diff --git a/client/client_types.h b/client/client_types.h index 737de198ee..0d45b0f4b5 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -255,6 +255,8 @@ public: // has a result in downloading state bool potentially_runnable(); // runnable or contactable or downloading + bool debt_adjust_allowed(); + // long term debt adjustment is allowed // temps used in CLIENT_STATE::rr_misses_deadline(); std::vectoractive; diff --git a/client/cs_apps.C b/client/cs_apps.C index 4ad55e7e72..d02e099e25 100644 --- a/client/cs_apps.C +++ b/client/cs_apps.C @@ -413,7 +413,7 @@ double CLIENT_STATE::potentially_runnable_resource_share() { double x = 0; for (unsigned int i=0; ipotentially_runnable()) { + if (p->debt_adjust_allowed()) { x += p->resource_share; } } @@ -471,7 +471,7 @@ void CLIENT_STATE::adjust_debts() { // adjust long-term debts // - if (p->potentially_runnable()) { + if (p->debt_adjust_allowed()) { nprojects++; share_frac = p->resource_share/prrs; p->long_term_debt += share_frac*total_wall_cpu_time_this_period @@ -524,7 +524,7 @@ void CLIENT_STATE::adjust_debts() { p->anticipated_debt = p->short_term_debt; //msg_printf(p, MSG_INFO, "debt %f", p->short_term_debt); } - if (p->potentially_runnable()) { + if (p->debt_adjust_allowed()) { p->long_term_debt -= avg_long_term_debt; } }