diff --git a/checkin_notes b/checkin_notes index e284ed2e4a..7ac1c81927 100755 --- a/checkin_notes +++ b/checkin_notes @@ -25175,3 +25175,15 @@ Rom 22 Feb 2005 MainFrame.cpp lib/ gui_rpc_client.C, .h + +David 22 Feb 2005 + - backend processes: centralize avg_turnaround updating, + and write log messages + - backend programs: define CRITICAL/NORMAL/DEBUG as 1/2/3 + so that message logging works as advertised + + sched/ + sched_msgs.h + sched_util.C,h + transitioner.C + validator.C diff --git a/sched/sched_msgs.h b/sched/sched_msgs.h index e097e3765e..bb96aa28e9 100644 --- a/sched/sched_msgs.h +++ b/sched/sched_msgs.h @@ -25,9 +25,9 @@ class SCHED_MSG_LOG : public MSG_LOG { bool v_message_wanted(int kind) const; public: enum Kind { - CRITICAL, - NORMAL, - DEBUG + CRITICAL=1, + NORMAL=2, + DEBUG=3 }; SCHED_MSG_LOG(): MSG_LOG(stderr) {} void set_debug_level(int new_level) { debug_level = new_level; } diff --git a/sched/sched_util.C b/sched/sched_util.C index c8519364da..7709664728 100644 --- a/sched/sched_util.C +++ b/sched/sched_util.C @@ -208,4 +208,18 @@ int extract_filename(char* in, char* out) { return 0; } +void compute_avg_turnaround(HOST& host, double turnaround) { + double new_avg; + if (host.avg_turnaround == 0) { + new_avg = turnaround; + } else { + new_avg = .7*host.avg_turnaround + .3*turnaround; + } + log_messages.printf(SCHED_MSG_LOG::NORMAL, + "turnaround %f; old %f; new %f\n", + turnaround, host.avg_turnaround, new_avg + ); + host.avg_turnaround = new_avg; +} + const char *BOINC_RCSID_affa6ef1e4 = "$Id$"; diff --git a/sched/sched_util.h b/sched/sched_util.h index 996ac6410e..ee9f57bc8d 100644 --- a/sched/sched_util.h +++ b/sched/sched_util.h @@ -20,6 +20,8 @@ #ifndef SCHED_UTIL_H #define SCHED_UTIL_H +#include "boinc_db.h" + // "average credit" uses an exponential decay so that recent // activity is weighted more heavily. // CREDIT_HALF_LIFE is the "half-life" period: @@ -54,4 +56,6 @@ extern int dir_hier_url( // extern int extract_filename(char* in, char* out); +extern void compute_avg_turnaround(HOST& host, double turnaround); + #endif diff --git a/sched/transitioner.C b/sched/transitioner.C index 3e65132df8..5e3cff318d 100644 --- a/sched/transitioner.C +++ b/sched/transitioner.C @@ -69,12 +69,7 @@ int penalize_host(int hostid, double delay_bound) { char buf[256]; int retval = host.lookup_id(hostid); if (retval) return retval; - if (host.avg_turnaround == 0) { - host.avg_turnaround = delay_bound; - } else { - host.avg_turnaround = .7*host.avg_turnaround + .3*delay_bound; - } - + compute_avg_turnaround(host, delay_bound); sprintf(buf, "avg_turnaround=%f", host.avg_turnaround); return host.update_field(buf); } diff --git a/sched/validator.C b/sched/validator.C index 0123aa076d..9269634121 100644 --- a/sched/validator.C +++ b/sched/validator.C @@ -112,11 +112,7 @@ int grant_credit(RESULT& result, double credit) { update_average(result.sent_time, credit, CREDIT_HALF_LIFE, host.expavg_credit, host.expavg_time); double turnaround = result.received_time - result.sent_time; - if (host.avg_turnaround == 0) { - host.avg_turnaround = turnaround; - } else { - host.avg_turnaround = .7*host.avg_turnaround + .3*turnaround; - } + compute_avg_turnaround(host, turnaround); sprintf( buf,