completion time estimate fixes

svn path=/trunk/boinc/; revision=2079
This commit is contained in:
Dan Werthimer 2003-08-13 21:32:07 +00:00
parent db30d604cb
commit 7b59ee9752
2 changed files with 13 additions and 10 deletions

View File

@ -1009,13 +1009,14 @@ int ACTIVE_TASK::get_cpu_time_via_shmem(time_t now) {
recent_change = 0;
} else {
recent_change += (fraction_done - last_frac_done);
if ((now-last_frac_update)>0) {
recent_change = max(0, recent_change);
int tdiff = now-last_frac_update;
if (tdiff>0) {
double recent_frac_rate_of_change = max(0, recent_change) / tdiff;
if (frac_rate_of_change == 0) {
frac_rate_of_change = recent_change;
frac_rate_of_change = recent_frac_rate_of_change;
} else {
double x = exp(-(now-last_frac_update)*log(2.0)/20.0);
frac_rate_of_change = frac_rate_of_change*x + recent_change*(1-x);
double x = exp(-1*log(2.0)/20.0);
frac_rate_of_change = frac_rate_of_change*x + recent_frac_rate_of_change*(1-x);
}
last_frac_update = now;
last_frac_done = fraction_done;
@ -1054,8 +1055,8 @@ double ACTIVE_TASK::est_time_to_completion() {
if (fraction_done <= 0 || fraction_done > 1 || frac_rate_of_change <= 0) {
return -1;
}
return (1.0-fraction_done)/frac_rate_of_change;
//return (current_cpu_time / fraction_done) - current_cpu_time;
return (current_cpu_time / fraction_done) - current_cpu_time;
//return (1.0-fraction_done)/frac_rate_of_change;
}
// size of output files and files in slot dir

View File

@ -384,16 +384,18 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs)
// to completion
double tocomp;
if(!at || at->fraction_done == 0) {
if(!at || (tocomp = at->est_time_to_completion()) <= 0) {
tocomp = gstate.estimate_cpu_time(*re->wup);
} else {
tocomp = at->est_time_to_completion();
}
if (tocomp > 0) {
cpuhour = (int)(tocomp / (60 * 60));
cpumin = (int)(tocomp / 60) % 60;
cpusec = (int)(tocomp) % 60;
strBuf.Format("%0.2d:%0.2d:%0.2d", cpuhour, cpumin, cpusec);
//strBuf.Format("%s [%.f]", strBuf, tocomp);
//if (at) {
// strBuf.Format("%s frac_done=%.7f frac_r=%.9f rec_ch=%.9f", strBuf, at->fraction_done, at->frac_rate_of_change, at->recent_change);
//}
} else {
strBuf = "---";
}