- client emulator: fix crash if you have active tasks of

non-CPU-intensive projects
This commit is contained in:
David Anderson 2013-02-28 23:52:58 -08:00 committed by Oliver Bock
parent 2dbfdc5505
commit 24b62b58a8
3 changed files with 34 additions and 5 deletions

View File

@ -109,6 +109,7 @@ void PROJECT::init() {
completions_ratio_stdev = 0.1; // for the first couple of completions - guess.
completions_required_stdevs = 3.0;
result_index = 0;
ignore = false;
#endif
}

View File

@ -331,6 +331,7 @@ struct PROJECT : PROJ_AM {
bool idle;
int max_infeasible_count;
bool no_apps;
bool ignore;
// for DCF variants:
int completed_task_count;
double completions_ratio_mean;

View File

@ -1311,21 +1311,48 @@ void cull_projects() {
app->project->no_apps = false;
}
}
vector<PROJECT*>::iterator iter;
iter = gstate.projects.begin();
while (iter != gstate.projects.end()) {
p = *iter;
for (i=0; i<gstate.projects.size(); i++) {
p = gstate.projects[i];
if (p->no_apps) {
fprintf(summary_file,
"%s: Removing from simulation - no apps\n",
p->project_name
);
iter = gstate.projects.erase(iter);
p->ignore = true;
} else if (p->non_cpu_intensive) {
fprintf(summary_file,
"%s: Removing from simulation - non CPU intensive\n",
p->project_name
);
p->ignore = true;
}
}
// remove results and active tasks of projects we're culling
//
vector<ACTIVE_TASK*>::iterator ati = gstate.active_tasks.active_tasks.begin();
while (ati != gstate.active_tasks.active_tasks.end()) {
ACTIVE_TASK* atp = *ati;
if (atp->wup->project->ignore) {
ati = gstate.active_tasks.active_tasks.erase(ati);
} else {
ati++;
}
}
vector<RESULT*>::iterator ri = gstate.results.begin();
while (ri != gstate.results.end()) {
RESULT* rp = *ri;
if (rp->project->ignore) {
ri = gstate.results.erase(ri);
} else {
ri++;
}
}
vector<PROJECT*>::iterator iter = gstate.projects.begin();
while (iter != gstate.projects.end()) {
p = *iter;
if (p->ignore) {
iter = gstate.projects.erase(iter);
} else {
iter++;