diff --git a/checkin_notes b/checkin_notes index 7ba1ee445f..c9cba96566 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4317,3 +4317,15 @@ Charlie 13 June 2012 client/ coproc_detect.cpp + +David 14 June 2012 + - scheduler: send only if client is 7.0.28 or later. + + sched/ + sched_types.cpp + vda/ + ssim.cpp + vdad.cpp + des.h + stats.cpp,h + vda_lib.cpp,h diff --git a/sched/sched_types.cpp b/sched/sched_types.cpp index 1274ca1a4f..b9fd633bc8 100644 --- a/sched/sched_types.cpp +++ b/sched/sched_types.cpp @@ -620,11 +620,12 @@ int SCHEDULER_REPLY::write(FILE* fout, SCHEDULER_REQUEST& sreq) { fprintf(fout, "Content-type: text/xml\n\n" "\n" - "%d\n" - //"\n" - , + "%d\n", BOINC_MAJOR_VERSION*100+BOINC_MINOR_VERSION ); + if (sreq.core_client_version >= 70028) { + fprintf(fout, "\n"); + } if (strlen(config.master_url)) { fprintf(fout, "%s\n", diff --git a/vda/des.h b/vda/des.h index b245fe50bc..61373b93ae 100644 --- a/vda/des.h +++ b/vda/des.h @@ -18,6 +18,9 @@ // The world's smallest discrete event simulator. // Uses the STL "heap" data structure for efficient event storage. +#ifndef _DES_ +#define _DES_ + #include #include @@ -32,7 +35,7 @@ struct EVENT { virtual void handle(){} }; -bool compare(EVENT* e1, EVENT* e2) { +inline bool compare(EVENT* e1, EVENT* e2) { return (e1->t > e2->t); } @@ -77,3 +80,7 @@ struct SIMULATOR { } } }; + +extern SIMULATOR sim; + +#endif diff --git a/vda/ssim.cpp b/vda/ssim.cpp index 89ebe780f2..d41500afc9 100644 --- a/vda/ssim.cpp +++ b/vda/ssim.cpp @@ -38,6 +38,7 @@ #include #include "des.h" +#include "stats.h" #include "vda_lib.h" using std::set; @@ -119,6 +120,10 @@ char* now_str() { return time_str(sim.now); } +void show_msg(char* msg) { + printf("%s: %s", time_str(sim.now), msg); +} + struct CHUNK; struct CHUNK_ON_HOST; struct META_CHUNK; @@ -204,8 +209,8 @@ struct SIM_FILE : VDA_FILE_AUX, EVENT { } else { meta_chunk = new META_CHUNK(this, NULL, size, 0, id); #ifdef EVENT_DEBUG - printf("created file %d: size %f encoded size %f\n", - id, size, disk_usage.value + printf("created file %d: size %f GB encoded size %f GB\n", + id, size/1e9, disk_usage.value/1e9 ); t = sim.now + 500.*86400; sim.insert(this); @@ -451,10 +456,12 @@ void CHUNK::download_complete() { } int META_CHUNK::encode() { + printf("%s: encoding metachunk %s\n", now_str(), name); return 0; } int META_CHUNK::decode() { + printf("%s: decoding metachunk %s\n", now_str(), name); return 0; } diff --git a/vda/stats.cpp b/vda/stats.cpp index 1178245ada..f162f5befd 100644 --- a/vda/stats.cpp +++ b/vda/stats.cpp @@ -19,23 +19,9 @@ #include #include +#include "vda_lib.h" #include "stats.h" -//#define SAMPLE_DEBUG - -char* time_str(double t) { - static char buf[256]; - int n = (int)t; - int nsec = n % 60; - n /= 60; - int nmin = n % 60; - n /= 60; - int nhour = n % 24; - n /= 24; - sprintf(buf, "%4d days %02d:%02d:%02d", n, nhour, nmin, nsec); - return buf; -} - void STATS_ITEM::init(const char* n, const char* filename, STATS_KIND k) { f = fopen(filename, "w"); strcpy(name, n); @@ -56,19 +42,23 @@ void STATS_ITEM::init(const char* n, const char* filename, STATS_KIND k) { } void STATS_ITEM::sample(double v, bool collecting_stats, double now) { -#ifdef SAMPLE_DEBUG - switch (kind) { - case DISK: - printf("%s: %s: %f GB -> %f GB\n", now_str(), name, value/1e9, v/1e9); - break; - case NETWORK: - printf("%s: %s: %f Mbps -> %f Mbps\n", now_str(), name, value/1e6, v/1e6); - break; - case FAULT_TOLERANCE: - printf("%s: %s: %.0f -> %.0f\n", now_str(), name, value, v); - break; + char buf[256]; + if (value != v) { + switch (kind) { + case DISK: + sprintf(buf, "%s: %f GB -> %f GB\n", name, value/1e9, v/1e9); + show_msg(buf); + break; + case NETWORK: + sprintf(buf, "%s: %f Mbps -> %f Mbps\n", name, value/1e6, v/1e6); + show_msg(buf); + break; + case FAULT_TOLERANCE: + sprintf(buf, "%s: %.0f -> %.0f\n", name, value, v); + show_msg(buf); + break; + } } -#endif double old_val = value; value = v; if (!collecting_stats) return; diff --git a/vda/stats.h b/vda/stats.h index 5794d8df67..9de8c86619 100644 --- a/vda/stats.h +++ b/vda/stats.h @@ -19,6 +19,11 @@ // (server disk usage, up/download rate, fault tolerance level) // +#ifndef _STATS_ +#define _STATS_ + +#include + typedef enum {DISK, NETWORK, FAULT_TOLERANCE} STATS_KIND; struct STATS_ITEM { @@ -40,4 +45,4 @@ struct STATS_ITEM { void print_summary(FILE* f, double now); }; -extern char* time_str(double); +#endif diff --git a/vda/vda_lib.cpp b/vda/vda_lib.cpp index bf4a092bca..aa7afc46bf 100644 --- a/vda/vda_lib.cpp +++ b/vda/vda_lib.cpp @@ -258,10 +258,10 @@ int META_CHUNK::recovery_action(double now) { // for (i=0; iname, c->min_failures); + //printf(" Min failures of %s: %d\n", c->name, c->min_failures); min_failures += c->min_failures; } - printf(" our min failures: %d\n", min_failures); + //printf(" our min failures: %d\n", min_failures); } return 0; } @@ -277,6 +277,8 @@ bool CHUNK::download_in_progress() { int CHUNK::recovery_action(double now) { int retval; + char buf[256]; + VDA_FILE_AUX* fp = parent->dfile; if (data_now_present) { present_on_server = true; @@ -309,9 +311,8 @@ int CHUNK::recovery_action(double now) { present_on_server = false; status = RECOVERABLE; min_failures = fp->policy.replication; -#ifdef EVENT_DEBUG - printf("%s: %s replicated, removing from server\n", now_str(), name); -#endif + sprintf(buf, "%s replicated, removing from server\n", name); + show_msg(buf); parent->dfile->disk_usage.sample_inc( -size, fp->collecting_stats(), @@ -471,3 +472,16 @@ int META_CHUNK::expand() { } return 0; } + +char* time_str(double t) { + static char buf[256]; + int n = (int)t; + int nsec = n % 60; + n /= 60; + int nmin = n % 60; + n /= 60; + int nhour = n % 24; + n /= 24; + sprintf(buf, "%4d days %02d:%02d:%02d", n, nhour, nmin, nsec); + return buf; +} diff --git a/vda/vda_lib.h b/vda/vda_lib.h index 849cbcd868..fe55318370 100644 --- a/vda/vda_lib.h +++ b/vda/vda_lib.h @@ -33,6 +33,9 @@ // #define VDA_HOST_TIMEOUT (86400*4) +extern void show_msg(char*); +extern char* time_str(double); + struct META_CHUNK; struct VDA_FILE_AUX : VDA_FILE { diff --git a/vda/vdad.cpp b/vda/vdad.cpp index c844fe571a..0d36927001 100644 --- a/vda/vdad.cpp +++ b/vda/vdad.cpp @@ -42,6 +42,10 @@ using std::set; #include "vda_lib.h" +void show_msg(char* msg) { + printf("%s", msg); +} + // return the name of a file created by Jerasure's encoder // // encoder creates files with names of the form