From fb47db934a3ff6e9e6a389b37b4bd8bc775d3511 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 10 Apr 2007 21:56:11 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=12341 --- checkin_notes | 9 +++++++ client/cpu_sched.C | 5 ++-- client/sim.C | 63 +++++++++++++++++++++++++--------------------- client/sim.h | 13 +++++----- 4 files changed, 52 insertions(+), 38 deletions(-) diff --git a/checkin_notes b/checkin_notes index 86d89abc8b..6541fcc929 100755 --- a/checkin_notes +++ b/checkin_notes @@ -3365,3 +3365,12 @@ Rom 10 Apr 2007 clientgui/ BOINCGridCtrl.cpp + +David 10 Apr 2007 + - core client: adjustment to anticipated debt is + resource_share*expected_payoff, not + (1-resource_share)*expected_payoff + + client/ + cpu_sched.C + sim.C,h diff --git a/client/cpu_sched.C b/client/cpu_sched.C index 584212df81..eb7fffc774 100644 --- a/client/cpu_sched.C +++ b/client/cpu_sched.C @@ -507,7 +507,7 @@ void CLIENT_STATE::schedule_cpus() { ram_left -= atp->procinfo.working_set_size_smoothed; } - rp->project->anticipated_debt -= (1 - rp->project->resource_share / rrs) * expected_pay_off; + rp->project->anticipated_debt -= (rp->project->resource_share / rrs) * expected_pay_off; rp->project->deadlines_missed--; rp->edf_scheduled = true; if (log_flags.cpu_sched_debug) { @@ -541,7 +541,8 @@ void CLIENT_STATE::schedule_cpus() { } ram_left -= atp->procinfo.working_set_size_smoothed; } - rp->project->anticipated_debt -= (1 - rp->project->resource_share / rrs) * expected_pay_off; + double xx = (rp->project->resource_share / rrs) * expected_pay_off; + rp->project->anticipated_debt -= xx; if (log_flags.cpu_sched_debug) { msg_printf(NULL, MSG_INFO, "[cpu_sched_debug] scheduling (regular) %s", rp->name); } diff --git a/client/sim.C b/client/sim.C index 037b1c1c10..d57c9553c3 100644 --- a/client/sim.C +++ b/client/sim.C @@ -409,6 +409,11 @@ bool ACTIVE_TASK_SET::poll() { case PROCESS_EXECUTING: atp->cpu_time_left -= diff; RESULT* rp = atp->result; + + double cpu_time_used = rp->final_cpu_time - atp->cpu_time_left; + atp->fraction_done = cpu_time_used/rp->final_cpu_time; + atp->checkpoint_wall_time = gstate.now; + if (atp->cpu_time_left <= 0) { atp->set_task_state(PROCESS_EXITED, "poll"); rp->exit_status = 0; @@ -435,13 +440,11 @@ bool ACTIVE_TASK_SET::poll() { if (p->idle) { p->idle_period_duration += diff; } else { - if (p->idle_period_duration) { - double ipd = p->idle_period_duration; - p->idle_period_sumsq += ipd*ipd; - p->nidle_periods++; - p->idle_period_duration = 0; - } + p->idle_period_duration = 0; } + double ipd = p->idle_period_duration; + p->idle_period_sumsq += ipd*ipd; + p->nidle_periods++; } return action; @@ -681,32 +684,28 @@ double CLIENT_STATE::variety() { return sqrt(sum/n); } +void SIM_RESULTS::compute() { + double total = cpu_used + cpu_wasted + cpu_idle; + cpu_wasted_frac = cpu_wasted/total; + cpu_idle_frac = cpu_idle/total; + share_violation = gstate.share_violation(); + variety = gstate.variety(); +} + // top-level results (for aggregating multiple simulations) // -void SIM_RESULTS::print(FILE* f) { - double total = cpu_used + cpu_wasted + cpu_idle; +void SIM_RESULTS::print(FILE* f, const char* title) { + if (title) { + fprintf(f, title); + } fprintf(f, "wasted %f idle %f share_violation %f variety %f\n", - cpu_wasted/total, cpu_idle/total, - gstate.share_violation(), - gstate.variety() + cpu_wasted_frac, cpu_idle_frac, share_violation, variety ); } -// all results (human-readable) -// -void SIM_RESULTS::print_pct(const char* title, FILE* f) { - double total = cpu_used + cpu_wasted + cpu_idle; - fprintf(f, "%s used %.2f%%, wasted %.2f%%, idle %.2f%%\n", - title, - (cpu_used/total)*100, - (cpu_wasted/total)*100, - (cpu_idle/total)*100 - ); -} void SIM_RESULTS::parse(FILE* f) { - fscanf(f, "used %lf wasted %lf idle %lf met %d missed %d", - &cpu_used, &cpu_wasted, &cpu_idle, - &nresults_met_deadline, &nresults_missed_deadline + fscanf(f, "wasted %lf idle %lf share_violation %lf variety %lf", + &cpu_wasted, &cpu_idle, &share_violation, &variety ); } void SIM_RESULTS::add(SIM_RESULTS& r) { @@ -884,8 +883,8 @@ void CLIENT_STATE::html_rec() { void CLIENT_STATE::html_end() { double cpu_total=sim_results.cpu_used + sim_results.cpu_wasted + sim_results.cpu_idle; fprintf(html_out, "
\n");
+    sim_results.compute();
     sim_results.print(html_out);
-    sim_results.print_pct("Total:", html_out);
     print_project_results(html_out);
     fprintf(html_out, "
\n"); fclose(html_out); @@ -994,11 +993,11 @@ int main(int argc, char** argv) { FILE* f = fopen(SUMMARY_FILE, "r"); sim_results.parse(f); fclose(f); - sim_results.print_pct(dir.c_str(), stdout); + sim_results.print(stdout, dir.c_str()); total_results.add(sim_results); chdir(".."); } - total_results.print_pct("Total", stdout); + total_results.print(stdout, "Total"); } else { read_config_file(); int retval; @@ -1014,7 +1013,13 @@ int main(int argc, char** argv) { gstate.set_ncpus(); gstate.request_work_fetch("init"); gstate.simulate(); - gstate.print_project_results(stdout); + + sim_results.compute(); + + // print machine-readable first sim_results.print(stdout); + + // then other + gstate.print_project_results(stdout); } } diff --git a/client/sim.h b/client/sim.h index 33e59159e1..decbd65268 100644 --- a/client/sim.h +++ b/client/sim.h @@ -25,14 +25,13 @@ struct SIM_RESULTS { double cpu_idle; int nresults_met_deadline; int nresults_missed_deadline; + double share_violation; + double variety; + double cpu_wasted_frac; + double cpu_idle_frac; - // top-level results (for aggregating multiple simulations) - // - void print(FILE* f); - - // all results (human-readable) - // - void print_pct(const char* title, FILE* f); + void compute(); + void print(FILE* f, const char* title=0); void parse(FILE* f); void add(SIM_RESULTS& r); SIM_RESULTS();