debt calculation

svn path=/trunk/boinc/; revision=9329
This commit is contained in:
David Anderson 2006-01-27 19:50:43 +00:00
parent 0524626bcc
commit 6e73fe56ca
4 changed files with 36 additions and 14 deletions

View File

@ -1085,3 +1085,9 @@ David 27 Jan 2006
AccountManagerPropertiesPage.cpp
CompletionRemovePage.cpp
CompletionUpdatePage.cpp
David 27 Jan 2006
- core client: fix calculation of STD/LTD
client/
cs_apps.C

View File

@ -448,4 +448,9 @@ extern double calculate_exponential_backoff(
int n, double MIN, double MAX
);
#ifdef NEW_CPU_SCHED
class CPU_SCHEDULER {
};
#endif
#endif

View File

@ -295,6 +295,9 @@ public:
bool checked;
// temporary used when scanning projects
#ifdef NEW_CPU_SCHED
void compute_cpu_share_needed();
#endif
// vars related to file-transfer backoff
// file_xfer_failures_up: count of consecutive upload failures
@ -435,13 +438,6 @@ struct RESULT {
// this may be NULL after result is finished
PROJECT* project;
// temporaries used in CLIENT_STATE::rr_misses_deadline():
double rrsim_cpu_left;
double rrsim_finish_delay;
bool already_selected;
// used to keep cpu scheduler from scheduling a result twice
// transient; used only within schedule_cpus()
void clear();
int parse_server(MIOFILE&);
int parse_state(MIOFILE&);
@ -452,6 +448,9 @@ struct RESULT {
void reset_files();
FILE_REF* lookup_file(FILE_INFO*);
FILE_INFO* lookup_file_logical(const char*);
// stuff related to CPU scheduling
double estimated_cpu_time();
double estimated_cpu_time_uncorrected();
double estimated_cpu_time_remaining();
@ -461,6 +460,13 @@ struct RESULT {
bool runnable_soon();
// downloading or downloaded,
// not finished, suspended, project not suspended
// temporaries used in CLIENT_STATE::rr_misses_deadline():
double rrsim_cpu_left;
double rrsim_finish_delay;
bool already_selected;
// used to keep cpu scheduler from scheduling a result twice
// transient; used only within schedule_cpus()
};
#endif

View File

@ -420,7 +420,7 @@ void CLIENT_STATE::adjust_debts() {
double total_long_term_debt = 0;
double total_short_term_debt = 0;
double prrs, rrs;
int nprojects = 0;
int nprojects=0, nrprojects=0;
PROJECT *p;
double share_frac;
double wall_cpu_time = gstate.now - cpu_sched_last_time;
@ -459,21 +459,21 @@ void CLIENT_STATE::adjust_debts() {
for (i=0; i<projects.size(); i++) {
p = projects[i];
if (p->non_cpu_intensive) continue;
nprojects++;
// adjust long-term debts
//
if (p->potentially_runnable()) {
nprojects++;
share_frac = p->resource_share/prrs;
p->long_term_debt += share_frac*total_wall_cpu_time_this_period
- p->wall_cpu_time_this_period
;
- p->wall_cpu_time_this_period;
total_long_term_debt += p->long_term_debt;
}
total_long_term_debt += p->long_term_debt;
// adjust short term debts
//
if (p->runnable()) {
nrprojects++;
share_frac = p->resource_share/rrs;
p->short_term_debt += share_frac*total_wall_cpu_time_this_period
- p->wall_cpu_time_this_period
@ -497,7 +497,10 @@ void CLIENT_STATE::adjust_debts() {
// normalize so mean is zero, and limit abs value at MAX_DEBT
//
double avg_long_term_debt = total_long_term_debt / nprojects;
double avg_short_term_debt = total_short_term_debt / nprojects;
double avg_short_term_debt = 0;
if (nrprojects) {
total_short_term_debt / nrprojects;
}
for (i=0; i<projects.size(); i++) {
p = projects[i];
if (p->non_cpu_intensive) continue;
@ -512,7 +515,9 @@ void CLIENT_STATE::adjust_debts() {
p->anticipated_debt = p->short_term_debt;
//msg_printf(p, MSG_INFO, "debt %f", p->short_term_debt);
}
p->long_term_debt -= avg_long_term_debt;
if (p->potentially_runnable()) {
p->long_term_debt -= avg_long_term_debt;
}
}
}