From 89548f04dab8a3c0f7da7d521d49fa068635d51f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 2 Dec 2008 22:19:39 +0000 Subject: [PATCH] - client: compute duration_correction_factor based on elapsed time, not CPU time (otherwise it doesn't work for coproc or multi-proc apps) - client: in estimate of job completion time, weight the estimate based on fraction done more heavily (quadratic rather than linear) svn path=/trunk/boinc/; revision=16603 --- checkin_notes | 13 +++++++++++++ client/client_types.h | 4 ++-- client/cpu_sched.cpp | 7 ++++--- client/cs_apps.cpp | 2 +- client/work_fetch.cpp | 4 +++- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/checkin_notes b/checkin_notes index 80b31e4441..9ed05b0a36 100644 --- a/checkin_notes +++ b/checkin_notes @@ -9775,3 +9775,16 @@ David 2 Dec 2008 app.h,cpp app_control.cpp work_fetch.cpp + +David 2 Dec 2008 + - client: compute duration_correction_factor based on elapsed time, not CPU time + (otherwise it doesn't work for coproc or multi-proc apps) + - client: in estimate of job completion time, + weight the estimate based on fraction done more heavily + (quadratic rather than linear) + + client/ + client_types.h + cpu_sched.cpp + cs_apps.cpp + work_fetch.cpp diff --git a/client/client_types.h b/client/client_types.h index 24e33256ba..ab8fbba54f 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -158,7 +158,7 @@ struct DAILY_STATS { int parse(FILE*); }; bool operator < (const DAILY_STATS&, const DAILY_STATS&); - +class ACTIVE_TASK; class PROJECT { public: // the following items come from the account file @@ -293,7 +293,7 @@ public: /// it goes down slowly but if a new estimate X is larger, /// the factor is set to X. double duration_correction_factor; - void update_duration_correction_factor(RESULT*); + void update_duration_correction_factor(ACTIVE_TASK*); // fields used by CPU scheduler and work fetch // everything from here on applies only to CPU intensive projects diff --git a/client/cpu_sched.cpp b/client/cpu_sched.cpp index 08771bf73d..525d36f13d 100644 --- a/client/cpu_sched.cpp +++ b/client/cpu_sched.cpp @@ -1313,7 +1313,8 @@ int ACTIVE_TASK::preempt(bool quit_task) { // Update the correction factor used to predict // completion time for this project's results // -void PROJECT::update_duration_correction_factor(RESULT* rp) { +void PROJECT::update_duration_correction_factor(ACTIVE_TASK* atp) { + RESULT* rp = atp->result; #ifdef SIM if (dcf_dont_use) { duration_correction_factor = 1.0; @@ -1324,8 +1325,8 @@ void PROJECT::update_duration_correction_factor(RESULT* rp) { return; } #endif - double raw_ratio = rp->final_cpu_time/rp->estimated_duration_uncorrected(); - double adj_ratio = rp->final_cpu_time/rp->estimated_duration(false); + double raw_ratio = atp->elapsed_time/rp->estimated_duration_uncorrected(); + double adj_ratio = atp->elapsed_time/rp->estimated_duration(false); double old_dcf = duration_correction_factor; // it's OK to overestimate completion time, diff --git a/client/cs_apps.cpp b/client/cs_apps.cpp index dff69fe1b9..c734507714 100644 --- a/client/cs_apps.cpp +++ b/client/cs_apps.cpp @@ -199,7 +199,7 @@ int CLIENT_STATE::app_finished(ACTIVE_TASK& at) { rp->set_state(RESULT_FILES_UPLOADING, "CS::app_finished"); rp->append_log_record(); #endif - rp->project->update_duration_correction_factor(rp); + rp->project->update_duration_correction_factor(&at); } double wall_cpu_time = now - debt_interval_start; diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index e3357cc4bb..0f0b2729f5 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -801,7 +801,9 @@ double ACTIVE_TASK::est_time_to_completion(bool for_work_fetch) { if (fraction_done <= 0) return wu_est; double frac_est = (elapsed_time / fraction_done) - elapsed_time; double fraction_left = 1-fraction_done; - double x = fraction_done*frac_est + fraction_left*fraction_left*wu_est; + double wu_weight = fraction_left * fraction_left; + double fd_weight = 1 - wu_weight; + double x = fd_weight*frac_est + wu_weight*fraction_left*wu_est; return x; }