mirror of https://github.com/BOINC/boinc.git
- client simulator: make the output more graphical
svn path=/trunk/boinc/; revision=24406
This commit is contained in:
parent
836e8aacf7
commit
c22f8f41b9
|
@ -7318,3 +7318,12 @@ David 14 Oct 2011
|
||||||
index.php
|
index.php
|
||||||
inc/
|
inc/
|
||||||
db_ops.inc
|
db_ops.inc
|
||||||
|
|
||||||
|
David 16 Oct 2011
|
||||||
|
- client simulator: make the output more graphical
|
||||||
|
|
||||||
|
html/
|
||||||
|
inc/
|
||||||
|
util.inc
|
||||||
|
client/
|
||||||
|
sim.cpp
|
||||||
|
|
|
@ -784,18 +784,29 @@ const char* colors[] = {
|
||||||
"#aa00aa",
|
"#aa00aa",
|
||||||
"#aaaa00",
|
"#aaaa00",
|
||||||
"#00aaaa",
|
"#00aaaa",
|
||||||
"#0000cc",
|
"#8800aa",
|
||||||
"#00cc00",
|
"#aa0088",
|
||||||
"#cc0000",
|
"#88aa00",
|
||||||
"#cc00cc",
|
"#aa8800",
|
||||||
"#cccc00",
|
"#00aa88",
|
||||||
"#00cccc",
|
"#0088aa",
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NCOLORS 12
|
#define NCOLORS 18
|
||||||
#define WIDTH1 100
|
#define WIDTH1 100
|
||||||
#define WIDTH2 400
|
#define WIDTH2 400
|
||||||
|
|
||||||
|
void show_project_colors() {
|
||||||
|
fprintf(html_out, "Projects:<br><table>\n");
|
||||||
|
for (unsigned int i=0; i<gstate.projects.size(); i++) {
|
||||||
|
PROJECT* p = gstate.projects[i];
|
||||||
|
fprintf(html_out,
|
||||||
|
"<tr><td bgcolor=%s><font color=ffffff>%s</font></td></tr>\n",
|
||||||
|
colors[p->index%NCOLORS], p->project_name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
fprintf(html_out, "</table>\n");
|
||||||
|
}
|
||||||
|
|
||||||
void job_count(PROJECT* p, int rsc_type, int& in_progress, int& done) {
|
void job_count(PROJECT* p, int rsc_type, int& in_progress, int& done) {
|
||||||
in_progress = done = 0;
|
in_progress = done = 0;
|
||||||
|
@ -833,7 +844,14 @@ void show_resource(int rsc_type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PROJECT* p = rp->project;
|
PROJECT* p = rp->project;
|
||||||
fprintf(html_out, "%.2f: <font color=%s>%s%s: %.2fG%s</font><br>\n",
|
if (!found) {
|
||||||
|
found = true;
|
||||||
|
fprintf(html_out,
|
||||||
|
"<table>\n"
|
||||||
|
"<tr><th>#devs</th><th>Job name</th><th>FLOPS left</th></tr>\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
fprintf(html_out, "<tr><td>%.2f</td><td bgcolor=%s><font color=#ffffff>%s%s</font></td><td>%.0fG%s</td></tr>\n",
|
||||||
ninst,
|
ninst,
|
||||||
colors[p->index%NCOLORS],
|
colors[p->index%NCOLORS],
|
||||||
atp->result->rr_sim_misses_deadline?"*":"",
|
atp->result->rr_sim_misses_deadline?"*":"",
|
||||||
|
@ -841,24 +859,29 @@ void show_resource(int rsc_type) {
|
||||||
atp->flops_left/1e9,
|
atp->flops_left/1e9,
|
||||||
buf
|
buf
|
||||||
);
|
);
|
||||||
found = true;
|
|
||||||
}
|
}
|
||||||
if (!found) fprintf(html_out, "IDLE");
|
if (found) {
|
||||||
fprintf(html_out, "<br>Jobs");
|
fprintf(html_out, "</table>\n");
|
||||||
|
} else {
|
||||||
|
fprintf(html_out, "IDLE\n");
|
||||||
|
}
|
||||||
|
fprintf(html_out,
|
||||||
|
"<table><tr><td>Project</td><td>Jobs in progress</td><td>Jobs done</td></tr>\n"
|
||||||
|
);
|
||||||
found = false;
|
found = false;
|
||||||
for (i=0; i<gstate.projects.size(); i++) {
|
for (i=0; i<gstate.projects.size(); i++) {
|
||||||
PROJECT* p = gstate.projects[i];
|
PROJECT* p = gstate.projects[i];
|
||||||
int in_progress, done;
|
int in_progress, done;
|
||||||
job_count(p, rsc_type, in_progress, done);
|
job_count(p, rsc_type, in_progress, done);
|
||||||
if (in_progress || done) {
|
if (in_progress || done) {
|
||||||
fprintf(html_out, "<br>%s: %d in prog, %d done\n",
|
fprintf(html_out, "<td bgcolor=%s><font color=#ffffff>%s</font></td><td>%d</td><td>%d</td></tr>\n",
|
||||||
p->project_name, in_progress, done
|
colors[p->index%NCOLORS], p->project_name, in_progress, done
|
||||||
);
|
);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) fprintf(html_out, " ---\n");
|
//if (!found) fprintf(html_out, " ---\n");
|
||||||
fprintf(html_out, "</td>");
|
fprintf(html_out, "</table></td>");
|
||||||
}
|
}
|
||||||
|
|
||||||
int nproc_types = 1;
|
int nproc_types = 1;
|
||||||
|
@ -874,12 +897,16 @@ void html_start() {
|
||||||
}
|
}
|
||||||
setbuf(html_out, 0);
|
setbuf(html_out, 0);
|
||||||
fprintf(index_file, "<br><a href=%s>Timeline</a>\n", TIMELINE_FNAME);
|
fprintf(index_file, "<br><a href=%s>Timeline</a>\n", TIMELINE_FNAME);
|
||||||
fprintf(html_out, "<h2>BOINC client simulator</h2>\n");
|
fprintf(html_out,
|
||||||
|
"<head><style> body, td, th { font-family: Verdana; font-size: 12px;} th {white-space: nowrap;}</style></head>\n"
|
||||||
|
"<h2>BOINC client emulator results</h2>\n"
|
||||||
|
);
|
||||||
|
show_project_colors();
|
||||||
fprintf(html_out,
|
fprintf(html_out,
|
||||||
"<table border=0 cellpadding=4><tr><th width=%d>Time</th>\n", WIDTH1
|
"<table border=0 cellpadding=4><tr><th width=%d>Time</th>\n", WIDTH1
|
||||||
);
|
);
|
||||||
fprintf(html_out,
|
fprintf(html_out,
|
||||||
"<th width=%d>CPU<br><font size=-2>Job name and estimated time left<br>color denotes project<br>* means EDF mode</font></th>", WIDTH2
|
"<th width=%d>CPU<br>* means EDF mode</th>", WIDTH2
|
||||||
);
|
);
|
||||||
if (coprocs.have_nvidia()) {
|
if (coprocs.have_nvidia()) {
|
||||||
fprintf(html_out, "<th width=%d>NVIDIA GPU</th>", WIDTH2);
|
fprintf(html_out, "<th width=%d>NVIDIA GPU</th>", WIDTH2);
|
||||||
|
|
|
@ -86,7 +86,7 @@ function show_scenarios() {
|
||||||
<h3>Scenarios</h3>
|
<h3>Scenarios</h3>
|
||||||
The inputs to BCE, called <b>scenarios</b>,
|
The inputs to BCE, called <b>scenarios</b>,
|
||||||
describe a particular computer and the project to which it's attached.
|
describe a particular computer and the project to which it's attached.
|
||||||
A scenario consists of 4 files:
|
A scenario consists of:
|
||||||
<ul>
|
<ul>
|
||||||
<li> <b>client_state.xml</b>: describes the host and projects.
|
<li> <b>client_state.xml</b>: describes the host and projects.
|
||||||
Any projects that don't currently have tasks are ignored.
|
Any projects that don't currently have tasks are ignored.
|
||||||
|
@ -305,7 +305,7 @@ function show_scenario() {
|
||||||
}
|
}
|
||||||
row2("Input files", $x);
|
row2("Input files", $x);
|
||||||
end_table();
|
end_table();
|
||||||
show_button("sim_web.php?action=simulation_form&scen=$name",
|
show_button("sim_web.php?action=simulation_form_short&scen=$name",
|
||||||
"Do new simulation",
|
"Do new simulation",
|
||||||
"Do new simulation"
|
"Do new simulation"
|
||||||
);
|
);
|
||||||
|
@ -330,9 +330,29 @@ function show_scenario() {
|
||||||
page_tail();
|
page_tail();
|
||||||
}
|
}
|
||||||
|
|
||||||
// form for simulation parameters:
|
function simulation_form_short() {
|
||||||
// duration, time step, policy options
|
$scen = get_str("scen");
|
||||||
//
|
page_head("Do simulation");
|
||||||
|
start_table();
|
||||||
|
echo "
|
||||||
|
<form action=sim_web.php method=post enctype=\"multipart/form-data\">
|
||||||
|
<input type=hidden name=action value=simulation_action>
|
||||||
|
<input type=hidden name=scen value=$scen>
|
||||||
|
<input type=hidden name=rec_half_life_days value=10>
|
||||||
|
<input type=hidden name=existing_jobs_only value=0>
|
||||||
|
<input type=hidden name=use_hyst_fetch value=1>
|
||||||
|
<input type=hidden name=cpu_sched_rr_only value=0>
|
||||||
|
<input type=hidden name=server_uses_workload value=0>
|
||||||
|
";
|
||||||
|
row2("Duration", "<input name=duration value=86400> seconds");
|
||||||
|
row2("Time step", "<input name=delta value=60> seconds");
|
||||||
|
row2("cc_config.xml", "<input type=file name=cc_config>");
|
||||||
|
row2("", "<input type=submit value=OK>");
|
||||||
|
echo "</form>\n";
|
||||||
|
end_table();
|
||||||
|
page_tail();
|
||||||
|
}
|
||||||
|
|
||||||
function simulation_form() {
|
function simulation_form() {
|
||||||
$scen = get_str("scen");
|
$scen = get_str("scen");
|
||||||
page_head("Do simulation");
|
page_head("Do simulation");
|
||||||
|
@ -484,6 +504,9 @@ case "show_scenario":
|
||||||
case "simulation_form":
|
case "simulation_form":
|
||||||
simulation_form();
|
simulation_form();
|
||||||
break;
|
break;
|
||||||
|
case "simulation_form_short":
|
||||||
|
simulation_form_short();
|
||||||
|
break;
|
||||||
case "simulation_action":
|
case "simulation_action":
|
||||||
simulation_action();
|
simulation_action();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -590,22 +590,25 @@ function post_int($name, $optional=false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_str($name, $optional=false) {
|
function get_str($name, $optional=false) {
|
||||||
if (!isset($_GET[$name])) {
|
if (isset($_GET[$name])) {
|
||||||
|
$x = $_GET[$name];
|
||||||
|
} else {
|
||||||
if (!$optional) {
|
if (!$optional) {
|
||||||
error_page("missing or bad parameter: $name");
|
error_page("missing or bad parameter: $name");
|
||||||
}
|
}
|
||||||
$x = null;
|
$x = null;
|
||||||
} else {
|
|
||||||
$x = $_GET[$name];
|
|
||||||
}
|
}
|
||||||
return undo_magic_quotes($x);
|
return undo_magic_quotes($x);
|
||||||
}
|
}
|
||||||
|
|
||||||
function post_str($name, $optional=false) {
|
function post_str($name, $optional=false) {
|
||||||
$x = null;
|
if (isset($_POST[$name])) {
|
||||||
if (isset($_POST[$name])) $x = $_POST[$name];
|
$x = $_POST[$name];
|
||||||
if (!$x && !$optional) {
|
} else {
|
||||||
error_page("missing or bad parameter: $name");
|
if (!$optional) {
|
||||||
|
error_page("missing or bad parameter: $name");
|
||||||
|
}
|
||||||
|
$x = null;
|
||||||
}
|
}
|
||||||
return undo_magic_quotes($x);
|
return undo_magic_quotes($x);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue