- validator: fix a divide by zero (happens w/ old clients

that don't report elapsed time)

svn path=/trunk/boinc/; revision=21788
This commit is contained in:
David Anderson 2010-06-22 18:09:55 +00:00
parent 0e4e823b4e
commit 1250f41313
2 changed files with 13 additions and 5 deletions

View File

@ -4467,3 +4467,10 @@ David 22 June 2010
client/
acct_mgr.cpp
David 22 June 2010
- validator: fix a divide by zero (happens w/ old clients
that don't report elapsed time)
sched/
credit.cpp

View File

@ -403,11 +403,11 @@ int get_pfc(
);
}
bool do_scale = true;
if (hav.et.n < MIN_HOST_SAMPLES) {
if (hav.et.n < MIN_HOST_SAMPLES || (hav.et.get_avg() <= 0)) {
do_scale = false;
if (config.debug_credit) {
log_messages.printf(MSG_NORMAL,
"[credit] [RESULT#%d] old client: no host scaling - too few samples %f\n",
"[credit] [RESULT#%d] old client: no host scaling - zero or too few samples %f\n",
r.id, hav.et.n
);
}
@ -425,7 +425,7 @@ int get_pfc(
}
}
if (do_scale) {
double s = r.cpu_time/(hav.et.get_avg()*wu.rsc_fpops_est);
double s = r.cpu_time / (hav.et.get_avg()*wu.rsc_fpops_est);
pfc *= s;
if (config.debug_credit) {
log_messages.printf(MSG_NORMAL,
@ -487,7 +487,7 @@ int get_pfc(
//
if (app.min_avg_pfc) {
bool do_scale = true;
if (hav.pfc.n < MIN_HOST_SAMPLES || hav.pfc.get_avg()==0) {
if (hav.pfc.n < MIN_HOST_SAMPLES || hav.pfc.get_avg()<=0) {
do_scale = false;
if (config.debug_credit) {
log_messages.printf(MSG_NORMAL,
@ -589,7 +589,7 @@ int get_pfc(
);
}
}
if (do_scale && hav.pfc.get_avg() == 0) {
if (do_scale && hav.pfc.get_avg() <= 0) {
do_scale = false;
if (config.debug_credit) {
log_messages.printf(MSG_NORMAL,
@ -676,6 +676,7 @@ int get_pfc(
// compute the average of some numbers,
// where each value is weighted by the sum of the other values.
// (reduces the weight of large outliers)
//
double low_average(vector<double>& v) {
int i;