mirror of https://github.com/BOINC/boinc.git
volunteer data archival simulator: a few tweaks
This commit is contained in:
parent
f1cb92184a
commit
7b5eace475
|
@ -11,5 +11,5 @@ vda_LDADD = $(SERVERLIBS)
|
|||
vdad_SOURCES = vdad.cpp vda_lib.cpp vda_lib2.cpp vda_policy.cpp stats.cpp
|
||||
vdad_LDADD = $(SERVERLIBS)
|
||||
|
||||
ssim_SOURCES = ssim.cpp vda_lib.cpp vda_policy.cpp stats.cpp
|
||||
ssim_SOURCES = ssim.cpp vda_lib.cpp vda_policy.cpp stats.cpp des.h
|
||||
ssim_LDADD = $(SERVERLIBS)
|
||||
|
|
|
@ -42,6 +42,7 @@ inline bool compare(EVENT* e1, EVENT* e2) {
|
|||
struct SIMULATOR {
|
||||
vector<EVENT*> events;
|
||||
double now;
|
||||
bool done;
|
||||
|
||||
// add an event
|
||||
//
|
||||
|
@ -70,6 +71,7 @@ struct SIMULATOR {
|
|||
// run the simulator for the given time period
|
||||
//
|
||||
void simulate(double dur) {
|
||||
done = false;
|
||||
while (events.size()) {
|
||||
EVENT* e = events.front();
|
||||
pop_heap(events.begin(), events.end(), compare);
|
||||
|
@ -77,6 +79,7 @@ struct SIMULATOR {
|
|||
now = e->t;
|
||||
if (now > dur) break;
|
||||
e->handle();
|
||||
if (done) break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
23
vda/ssim.cpp
23
vda/ssim.cpp
|
@ -59,6 +59,9 @@ using std::set;
|
|||
|
||||
bool log_actions = false;
|
||||
|
||||
double min_failures_time[100];
|
||||
int min_min_failures = 100;
|
||||
|
||||
// We simulate policies based on coding and replication.
|
||||
//
|
||||
// Coding means that data is divided into M = N+K units,
|
||||
|
@ -245,7 +248,10 @@ struct SIM_FILE : VDA_FILE_AUX, EVENT {
|
|||
meta_chunk->recovery_plan();
|
||||
if (meta_chunk->status == UNRECOVERABLE) {
|
||||
printf("FILE IS LOST!!\n");
|
||||
exit(0);
|
||||
sim.done = true;
|
||||
min_min_failures = 0;
|
||||
min_failures_time[0] = sim.now;
|
||||
return;
|
||||
}
|
||||
if (debug_status) {
|
||||
printf("decide_reconstruct():\n");
|
||||
|
@ -260,10 +266,15 @@ struct SIM_FILE : VDA_FILE_AUX, EVENT {
|
|||
}
|
||||
meta_chunk->recovery_action(sim.now);
|
||||
meta_chunk->compute_min_failures();
|
||||
printf(" Min failures: %d\n", meta_chunk->min_failures);
|
||||
int mf = meta_chunk->min_failures;
|
||||
printf(" Min failures: %d\n", mf);
|
||||
fault_tolerance.sample(
|
||||
meta_chunk->min_failures-1, collecting_stats(), sim.now
|
||||
mf-1, collecting_stats(), sim.now
|
||||
);
|
||||
while (mf < min_min_failures) {
|
||||
min_min_failures--;
|
||||
min_failures_time[min_min_failures] = sim.now;
|
||||
}
|
||||
}
|
||||
|
||||
void print_stats(double now) {
|
||||
|
@ -628,4 +639,10 @@ int main(int argc, char** argv) {
|
|||
|
||||
printf("%s: simulation finished\n", now_str());
|
||||
dfile->print_stats(sim.now);
|
||||
|
||||
FILE* f = fopen("mft.dat", "w");
|
||||
for (int i=0; i<=policy.max_ft; i++) {
|
||||
fprintf(f, "%d %f\n", i, min_failures_time[i]);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue