- client: network bandwidth total was counting 1 day too many

- client simulator: start GPU support

svn path=/trunk/boinc/; revision=21311
This commit is contained in:
David Anderson 2010-04-28 16:22:06 +00:00
parent 4b46d1c114
commit 2a39bf3da0
6 changed files with 89 additions and 13 deletions

View File

@ -3233,3 +3233,10 @@ Charlie 28 Apr 2010
clientgui/
DlgEventLog.cpp
DlgEventLogListCtrl.cpp
David 28 Apr 2010
- client: network bandwidth total was counting 1 day too many
- client simulator: start GPU support
client/
net_stats.cpp

View File

@ -28,5 +28,5 @@ OBJS = \
all: sim
sim: $(OBJS)
sim: $(OBJS) sim.h
$(CXX) $(CXXFLAGS) $(OBJS) -o sim -ldl

View File

@ -378,7 +378,7 @@ void DAILY_XFER_HISTORY::totals(int ndays, double& up, double& down) {
up = down = 0;
for (unsigned int i=0; i<daily_xfers.size(); i++) {
DAILY_XFER& dx = daily_xfers[i];
if (dx.when < d) break;
if (dx.when <= d) break;
up += dx.up;
down += dx.down;
}

View File

@ -557,6 +557,49 @@ char* colors[] = {
static int outfile_num=0;
bool uses_coproc(RESULT* rp, COPROC* cp) {
}
bool using_instance(RESULT*, int) {
}
void gpu_header() {
for (unsigned int i=0; i<gstate.host_info.coprocs.coprocs.size(); i++) {
COPROC* cp = gstate.host_info.coprocs.coprocs[i];
for (int j=0; j<cp->count; j++) {
fprintf(gstate.html_out, "<th>%s %d</th>", cp->type, j);
}
}
}
void gpu_off() {
for (unsigned int i=0; i<gstate.host_info.coprocs.coprocs.size(); i++) {
COPROC* cp = gstate.host_info.coprocs.coprocs[i];
for (int j=0; j<cp->count; j++) {
fprintf(gstate.html_out, "<td bgcolor=#aaaaaa>OFF</td>");
}
}
}
void gpu_on() {
for (unsigned int i=0; i<gstate.host_info.coprocs.coprocs.size(); i++) {
COPROC* cp = gstate.host_info.coprocs.coprocs[i];
for (int j=0; j<cp->count; j++) {
for (unsigned int k=0; k<gstate.active_tasks.active_tasks.size(); k++) {
ACTIVE_TASK* atp = gstate.active_tasks.active_tasks[k];
RESULT* rp = atp->result;
if (!uses_coproc(rp, cp)) continue;
if (atp->task_state() != PROCESS_EXECUTING) continue;
if (!using_instance(rp, j)) continue;
SIM_PROJECT* p = (SIM_PROJECT*)rp->project;
fprintf(gstate.html_out, "<td bgcolor=%s>%s%s: %.2f</td>",
colors[p->index],
atp->result->rr_sim_misses_deadline?"*":"",
atp->result->name, atp->cpu_time_left
);
}
}
}
}
void CLIENT_STATE::html_start(bool show_prev) {
char buf[256];
@ -583,6 +626,7 @@ void CLIENT_STATE::html_start(bool show_prev) {
"<th>CPU %d<br><font size=-2>Job name and estimated time left<br>color denotes project<br>* means EDF mode</font></th>", i
);
}
gpu_header();
fprintf(html_out, "<th>Notes</th></tr>\n");
}
@ -595,6 +639,7 @@ void CLIENT_STATE::html_rec() {
for (int j=0; j<ncpus; j++) {
fprintf(html_out, "<td bgcolor=#aaaaaa>OFF</td>");
}
gpu_off();
} else {
int n=0;
for (unsigned int i=0; i<active_tasks.active_tasks.size(); i++) {
@ -614,7 +659,9 @@ void CLIENT_STATE::html_rec() {
n++;
}
}
fprintf(html_out, "<td><font size=-2>%s</font></td></tr>\n", html_msg.c_str());
fprintf(html_out,
"<td><font size=-2>%s</font></td></tr>\n", html_msg.c_str()
);
html_msg = "";
if (++line_num == line_limit) {

View File

@ -64,16 +64,14 @@ struct PROJECT_RESULTS {
int nresults_missed_deadline;
};
class NORMAL_DIST {
public:
struct NORMAL_DIST {
double mean;
double stdev;
int parse(XML_PARSER&, char* end_tag);
double sample();
};
class UNIFORM_DIST {
public:
struct UNIFORM_DIST {
double lo;
double hi;
int parse(XML_PARSER&, char* end_tag);
@ -94,8 +92,7 @@ public:
RANDOM_PROCESS();
};
class SIM_APP: public APP {
public:
struct SIM_APP: public APP {
double latency_bound;
double fpops_est;
NORMAL_DIST fpops;
@ -107,8 +104,7 @@ public:
int parse(XML_PARSER&);
};
class SIM_PROJECT: public PROJECT {
public:
struct SIM_PROJECT: public PROJECT {
RANDOM_PROCESS available;
int index;
int result_index;
@ -131,8 +127,12 @@ public:
void update_dcf_stats(RESULT*);
};
class SIM_HOST: public HOST_INFO {
public:
struct SIM_GPU : public COPROC {
double flops;
int parse(XML_PARSER&, const char*);
};
struct SIM_HOST: public HOST_INFO {
RANDOM_PROCESS available;
RANDOM_PROCESS idle;
double connection_interval;

View File

@ -502,6 +502,20 @@ int SIM_PROJECT::parse(XML_PARSER& xp) {
return ERR_XML_PARSE;
}
int SIM_GPU::parse(XML_PARSER& xp, const char* end_tag) {
char tag[256];
bool is_tag;
while(!xp.get(tag, sizeof(tag), is_tag)) {
if (!is_tag) return ERR_XML_PARSE;
if (!strcmp(tag, end_tag)) return 0;
else if (xp.parse_int(tag, "count", count)) continue;
else if (xp.parse_double(tag, "flops", flops)) continue;
else if (xp.parse_str(tag, "type", type, sizeof(type))) continue;
else return ERR_XML_PARSE;
}
return ERR_XML_PARSE;
}
int SIM_HOST::parse(XML_PARSER& xp) {
char tag[256];
bool is_tag;
@ -524,6 +538,14 @@ int SIM_HOST::parse(XML_PARSER& xp) {
retval = idle.parse(xp, "/idle");
if (retval) return retval;
idle.init(START_TIME);
} else if (!strcmp(tag, "gpu")) {
SIM_GPU* sgp = new SIM_GPU;
retval = sgp->parse(xp, "/gpu");
if (retval) {
delete sgp;
return retval;
}
coprocs.coprocs.push_back(sgp);
} else {
printf("unrecognized: %s\n", tag);
return ERR_XML_PARSE;