For computing and tracking a host's average credit/cpu_time I

have inserted a new averaging function
update_credit_per_cpu_sec() into lib/util.C.  This function
should be called from validator.C, and then the value of
credit_per_cpu_sec should be exported by db_dump.C in the
host_id.gz stats file.

David, Eric, if you could check the code and logic here I would
be grateful. This is currently disabled in validator.C with
a #ifdef macro.  I won't enable it until we've agreed on this.

svn path=/trunk/boinc/; revision=11136
This commit is contained in:
Bruce Allen 2006-09-11 11:41:54 +00:00
parent 3efc634fdf
commit 2c45c1708f
3 changed files with 22 additions and 6 deletions

View File

@ -10107,11 +10107,14 @@ Bruce 10 Sept 2006
host_id.gz stats file.
David, Eric, if you could check the code and logic here I would
be grateful. I won't modify validator.C or db_dump.C until
we've agreed on this.
be grateful. This is currently disabled in validator.C with
a #ifdef macro. I won't enable it until we've agreed on this.
lib/
util.C
util.h
sched/
db_dump.C
validator.C

View File

@ -325,13 +325,15 @@ void write_host(HOST& host, FILE* f, bool detail) {
" <p_model>%s</p_model>\n"
" <os_name>%s</os_name>\n"
" <os_version>%s</os_version>\n",
" <credit_per_cpu_sec>%f</credit_per_cpu_sec>\n",
host.total_credit,
host.expavg_credit,
host.expavg_time,
p_vendor,
p_model,
os_name,
os_version
os_version,
host.credit_per_cpu_sec
);
if (detail) {
fprintf(f,

View File

@ -121,11 +121,22 @@ int grant_credit(RESULT& result, double credit) {
double turnaround = result.received_time - result.sent_time;
compute_avg_turnaround(host, turnaround);
#ifdef TEST_CREDIT_PER_CPU_SEC
int err = update_credit_per_cpu_sec(credit, result.cpu_time, host.credit_per_cpu_sec);
if (err) {
log_messages.printf(
SCHED_MSG_LOG::MSG_CRITICAL,
"[RESULT#%d][HOST#%d] claimed too much credit (%f) in too little CPU time (%f)\n",
result.id, result.hostid, credit, result.cpu_time
);
}
#endif
sprintf(
buf,
"total_credit=total_credit+%f, expavg_credit=%f, expavg_time=%f, avg_turnaround=%f",
credit, host.expavg_credit, host.expavg_time, host.avg_turnaround
"total_credit=total_credit+%f, expavg_credit=%f, expavg_time=%f, avg_turnaround=%f, credit_per_cpu_sec=%f",
credit, host.expavg_credit, host.expavg_time, host.avg_turnaround, host.credit_per_cpu_sec
);
retval = host.update_field(buf);
if (retval) {