2007-05-15 20:47:42 +00:00
|
|
|
<?php
|
|
|
|
|
2007-07-17 20:34:37 +00:00
|
|
|
require_once("docutil.php");
|
|
|
|
|
2007-05-15 20:47:42 +00:00
|
|
|
function show_form() {
|
|
|
|
echo "
|
|
|
|
<form action=sim_form.php method=post>
|
|
|
|
|
2010-09-28 20:17:09 +00:00
|
|
|
<b>client_state.xml</b>
|
2007-05-15 20:47:42 +00:00
|
|
|
<br>
|
2010-09-28 20:17:09 +00:00
|
|
|
<textarea name=client_state rows=10 cols=80>
|
|
|
|
</textarea>
|
2007-05-15 20:47:42 +00:00
|
|
|
|
|
|
|
<p>
|
2010-09-28 20:17:09 +00:00
|
|
|
<b>global_prefs.xml:</b> (the host's preferences)
|
2007-05-15 20:47:42 +00:00
|
|
|
<br>
|
2010-09-28 20:17:09 +00:00
|
|
|
<textarea name=global_prefs rows=10 cols=80>
|
|
|
|
</textarea>
|
2007-05-15 20:47:42 +00:00
|
|
|
|
2010-10-17 20:12:14 +00:00
|
|
|
<p>
|
|
|
|
<b>global_prefs_override.xml:</b> (the host's preferences override file)
|
|
|
|
<br>
|
|
|
|
<textarea name=global_prefs_override rows=10 cols=80>
|
|
|
|
</textarea>
|
|
|
|
|
2007-05-15 20:47:42 +00:00
|
|
|
<p>
|
2007-07-18 23:26:49 +00:00
|
|
|
<b>cc_config.xml:</b> (the client configuration options)
|
2007-05-15 20:47:42 +00:00
|
|
|
<br>
|
2010-09-28 20:17:09 +00:00
|
|
|
<textarea name=cc_config rows=10 cols=80>
|
|
|
|
</textarea>
|
2007-05-15 20:47:42 +00:00
|
|
|
|
|
|
|
<p>
|
2007-07-18 23:26:49 +00:00
|
|
|
<b>
|
|
|
|
The following control how long the simulation runs.
|
|
|
|
Duration may not exceed TimeStep*10000.
|
|
|
|
</b>
|
2007-07-17 20:34:37 +00:00
|
|
|
<br>Time step: <input name=delta value=60>
|
|
|
|
<br>Duration: <input name=duration value=86400>
|
2007-07-18 23:26:49 +00:00
|
|
|
<p>
|
|
|
|
<b>
|
2010-11-30 19:36:07 +00:00
|
|
|
Scheduling policy options:
|
2007-07-18 23:26:49 +00:00
|
|
|
</b>
|
|
|
|
|
2007-05-15 20:47:42 +00:00
|
|
|
<p>
|
2010-11-30 19:36:07 +00:00
|
|
|
Client uses Recent Estimated Credit scheduling? <input type=checkbox name=rec>
|
|
|
|
<br>(default: debt-based scheduling)
|
2007-05-15 20:47:42 +00:00
|
|
|
<p>
|
2010-11-30 19:36:07 +00:00
|
|
|
Server does EDF simulation to predict deadline misses? <input type=checkbox name=suw>
|
|
|
|
<br>(default: approximate method)
|
|
|
|
<p>
|
|
|
|
Client uses only round-robin CPU scheduling? <input type=checkbox name=rr_only>
|
|
|
|
<br>(default: round-robin and EDF hybrid)
|
2007-05-15 20:47:42 +00:00
|
|
|
<p>
|
2007-07-17 20:34:37 +00:00
|
|
|
<input type=submit name=submit value=\"Run simulation\">
|
2007-05-15 20:47:42 +00:00
|
|
|
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2010-10-07 21:41:31 +00:00
|
|
|
// ?? the actual function doesn't seem to work here
|
|
|
|
function file_put_contents_aux($fname, $str) {
|
|
|
|
$f = fopen($fname, "w");
|
|
|
|
if (!$f) die("fopen");
|
|
|
|
$x = fwrite($f, $str);
|
|
|
|
if (!$x) die("fwrite");
|
|
|
|
fclose($f);
|
|
|
|
}
|
|
|
|
|
2007-05-15 20:47:42 +00:00
|
|
|
if ($_POST['submit']) {
|
|
|
|
chdir("sim");
|
|
|
|
|
2010-10-17 04:01:36 +00:00
|
|
|
$prefix = tempnam("/tmp", "sim");
|
|
|
|
|
2010-10-07 21:41:31 +00:00
|
|
|
$x = $_POST['client_state'];
|
|
|
|
if (!strlen($x)) {
|
|
|
|
die("missing state");
|
2010-09-28 20:17:09 +00:00
|
|
|
}
|
2010-10-17 04:01:36 +00:00
|
|
|
$state_fname = $prefix."client_state.xml";
|
2010-10-07 21:41:31 +00:00
|
|
|
file_put_contents_aux($state_fname, $x);
|
|
|
|
|
|
|
|
$x = $_POST['global_prefs'];
|
|
|
|
if (strlen($x)) {
|
2010-10-17 04:01:36 +00:00
|
|
|
$prefs_fname = $prefix."global_prefs.xml";
|
2010-10-07 21:41:31 +00:00
|
|
|
file_put_contents_aux($prefs_fname, $x);
|
2010-09-28 20:17:09 +00:00
|
|
|
}
|
2010-10-07 21:41:31 +00:00
|
|
|
|
2010-10-17 20:12:14 +00:00
|
|
|
$x = $_POST['global_prefs_override'];
|
|
|
|
if (strlen($x)) {
|
|
|
|
$prefs_override_fname = $prefix."global_prefs_override.xml";
|
|
|
|
file_put_contents_aux($prefs_override_fname, $x);
|
|
|
|
}
|
|
|
|
|
2010-10-07 21:41:31 +00:00
|
|
|
$x = $_POST['cc_config'];
|
|
|
|
if (strlen($x)) {
|
2010-10-17 04:01:36 +00:00
|
|
|
$config_fname = $prefix."cc_config.xml";
|
2010-10-07 21:41:31 +00:00
|
|
|
file_put_contents_aux($config_fname, $x);
|
2007-05-15 20:47:42 +00:00
|
|
|
}
|
2010-10-07 21:41:31 +00:00
|
|
|
|
2007-05-15 20:47:42 +00:00
|
|
|
$duration = $_POST['duration'];
|
|
|
|
|
|
|
|
$delta = $_POST['delta'];
|
|
|
|
if ($delta < 1) {
|
|
|
|
echo "time step must be >= 1";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2007-07-17 20:34:37 +00:00
|
|
|
if ($duration/$delta > 10000) {
|
|
|
|
echo "duration/step must be <= 10000";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2007-05-15 20:47:42 +00:00
|
|
|
$suw = '';
|
|
|
|
if ($_POST['suw']) {
|
|
|
|
$suw = '--server_uses_workload';
|
|
|
|
}
|
|
|
|
|
|
|
|
$rr_only = '';
|
|
|
|
if ($_POST['rr_only']) {
|
|
|
|
$rr_only = '--cpu_sched_rr_only';
|
|
|
|
}
|
|
|
|
|
2010-11-30 22:12:14 +00:00
|
|
|
$prog = "./sim_debt";
|
|
|
|
if ($_POST['use_rec']) {
|
|
|
|
$prog = "./sim_rec";
|
|
|
|
}
|
|
|
|
|
|
|
|
$cmd = "$prog --duration $duration --delta $delta $suw --file_prefix $prefix $rr_only $llflag";
|
2010-10-07 21:41:31 +00:00
|
|
|
|
|
|
|
$x = system($cmd);
|
|
|
|
|
2010-10-17 04:01:36 +00:00
|
|
|
Header("Location: ".$prefix."index.html");
|
2007-05-15 20:47:42 +00:00
|
|
|
} else {
|
2007-07-17 20:34:37 +00:00
|
|
|
page_head("BOINC client simulator");
|
|
|
|
echo "
|
|
|
|
This is a web interface to the BOINC client simulator.
|
2007-07-18 23:26:49 +00:00
|
|
|
Fill in the following form to specify the
|
|
|
|
<a href=trac/wiki/ClientSim>parameters of your simulation</a>.
|
|
|
|
The results will be shown in your browser.
|
|
|
|
<p>
|
2007-07-17 20:34:37 +00:00
|
|
|
";
|
2007-05-15 20:47:42 +00:00
|
|
|
show_form();
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|