- client simulator: make the output more graphical

svn path=/trunk/boinc/; revision=24406
This commit is contained in:
David Anderson 2011-10-17 06:13:51 +00:00
parent 836e8aacf7
commit c22f8f41b9
4 changed files with 91 additions and 29 deletions

View File

@ -7318,3 +7318,12 @@ David 14 Oct 2011
index.php
inc/
db_ops.inc
David 16 Oct 2011
- client simulator: make the output more graphical
html/
inc/
util.inc
client/
sim.cpp

View File

@ -784,18 +784,29 @@ const char* colors[] = {
"#aa00aa",
"#aaaa00",
"#00aaaa",
"#0000cc",
"#00cc00",
"#cc0000",
"#cc00cc",
"#cccc00",
"#00cccc",
"#8800aa",
"#aa0088",
"#88aa00",
"#aa8800",
"#00aa88",
"#0088aa",
};
#define NCOLORS 12
#define NCOLORS 18
#define WIDTH1 100
#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) {
in_progress = done = 0;
@ -833,7 +844,14 @@ void show_resource(int rsc_type) {
}
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,
colors[p->index%NCOLORS],
atp->result->rr_sim_misses_deadline?"*":"",
@ -841,24 +859,29 @@ void show_resource(int rsc_type) {
atp->flops_left/1e9,
buf
);
found = true;
}
if (!found) fprintf(html_out, "IDLE");
fprintf(html_out, "<br>Jobs");
if (found) {
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;
for (i=0; i<gstate.projects.size(); i++) {
PROJECT* p = gstate.projects[i];
int in_progress, done;
job_count(p, rsc_type, in_progress, done);
if (in_progress || done) {
fprintf(html_out, "<br>%s: %d in prog, %d done\n",
p->project_name, in_progress, done
fprintf(html_out, "<td bgcolor=%s><font color=#ffffff>%s</font></td><td>%d</td><td>%d</td></tr>\n",
colors[p->index%NCOLORS], p->project_name, in_progress, done
);
found = true;
}
}
if (!found) fprintf(html_out, " ---\n");
fprintf(html_out, "</td>");
//if (!found) fprintf(html_out, " ---\n");
fprintf(html_out, "</table></td>");
}
int nproc_types = 1;
@ -874,12 +897,16 @@ void html_start() {
}
setbuf(html_out, 0);
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,
"<table border=0 cellpadding=4><tr><th width=%d>Time</th>\n", WIDTH1
);
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()) {
fprintf(html_out, "<th width=%d>NVIDIA GPU</th>", WIDTH2);

View File

@ -86,7 +86,7 @@ function show_scenarios() {
<h3>Scenarios</h3>
The inputs to BCE, called <b>scenarios</b>,
describe a particular computer and the project to which it's attached.
A scenario consists of 4 files:
A scenario consists of:
<ul>
<li> <b>client_state.xml</b>: describes the host and projects.
Any projects that don't currently have tasks are ignored.
@ -305,7 +305,7 @@ function show_scenario() {
}
row2("Input files", $x);
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"
);
@ -330,9 +330,29 @@ function show_scenario() {
page_tail();
}
// form for simulation parameters:
// duration, time step, policy options
//
function simulation_form_short() {
$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() {
$scen = get_str("scen");
page_head("Do simulation");
@ -484,6 +504,9 @@ case "show_scenario":
case "simulation_form":
simulation_form();
break;
case "simulation_form_short":
simulation_form_short();
break;
case "simulation_action":
simulation_action();
break;

View File

@ -590,22 +590,25 @@ function post_int($name, $optional=false) {
}
function get_str($name, $optional=false) {
if (!isset($_GET[$name])) {
if (isset($_GET[$name])) {
$x = $_GET[$name];
} else {
if (!$optional) {
error_page("missing or bad parameter: $name");
}
$x = null;
} else {
$x = $_GET[$name];
}
return undo_magic_quotes($x);
}
function post_str($name, $optional=false) {
$x = null;
if (isset($_POST[$name])) $x = $_POST[$name];
if (!$x && !$optional) {
error_page("missing or bad parameter: $name");
if (isset($_POST[$name])) {
$x = $_POST[$name];
} else {
if (!$optional) {
error_page("missing or bad parameter: $name");
}
$x = null;
}
return undo_magic_quotes($x);
}