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
|
|
|
|
|
|
|
<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>
|
|
|
|
The following controls enable various experimental policies.
|
|
|
|
The standard policy (as of 5.10.13) is no checkboxes enabled,
|
|
|
|
and the 'Normal' DCF policy.
|
|
|
|
</b>
|
|
|
|
|
2007-05-15 20:47:42 +00:00
|
|
|
<p>
|
2007-07-17 20:34:37 +00:00
|
|
|
Server does EDF simulation based on current workload? <input type=checkbox name=suw>
|
2007-05-15 20:47:42 +00:00
|
|
|
<p>
|
2007-07-17 20:34:37 +00:00
|
|
|
Client uses Round-Robin (old-style) CPU scheduling? <input type=checkbox name=rr_only>
|
2007-05-15 20:47:42 +00:00
|
|
|
<p>
|
2007-07-11 20:13:53 +00:00
|
|
|
Client uses old work fetch policy? <input type=checkbox name=work_fetch_old>
|
|
|
|
<p>
|
2007-07-17 20:34:37 +00:00
|
|
|
Duration correction factor: <input type=radio name=dcf value=normal checked> Normal
|
2007-05-15 20:47:42 +00:00
|
|
|
: <input type=radio name=dcf value=stats> Stats
|
|
|
|
: <input type=radio name=dcf value=dual> Dual
|
|
|
|
: <input type=radio name=dcf value=none> None
|
|
|
|
<p>
|
2007-07-12 18:38:53 +00:00
|
|
|
HTML output lines per file: <input name=line_limit>
|
|
|
|
<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>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($_POST['submit']) {
|
|
|
|
chdir("sim");
|
|
|
|
|
2010-09-28 20:17:09 +00:00
|
|
|
if (!file_put_contents("client_state.xml", $_POST['client_state'])) {
|
|
|
|
echo "Can't write client_state.xml - check permissions\n"; exit();
|
|
|
|
}
|
|
|
|
if (!file_put_contents("global_prefs.xml", $_POST['global_prefs'])) {
|
|
|
|
echo "Can't write global_prefs.xml - check permissions\n"; exit();
|
|
|
|
}
|
|
|
|
if (!file_put_contents("cc_config.xml", $_POST['cc_config'])) {
|
|
|
|
echo "Can't write cc_config.xml - check permissions\n"; exit();
|
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';
|
|
|
|
}
|
2007-07-11 20:13:53 +00:00
|
|
|
$work_fetch_old = '';
|
|
|
|
if ($_POST['work_fetch_old']) {
|
|
|
|
$work_fetch_old = '--work_fetch_old';
|
|
|
|
}
|
2007-05-15 20:47:42 +00:00
|
|
|
|
|
|
|
$dcfflag = "";
|
|
|
|
$dcf = ($_POST['dcf']);
|
|
|
|
if ($dcf == "stats") {
|
|
|
|
$dcfflag = '--dcf_stats';
|
|
|
|
} else if ($dcf == 'none') {
|
|
|
|
$dcfflag = '--dcf_dont_use';
|
|
|
|
} else if ($dcf == 'dual') {
|
|
|
|
$dcfflag = '--dual_dcf';
|
|
|
|
}
|
|
|
|
|
2007-07-12 18:38:53 +00:00
|
|
|
$llflag = '';
|
|
|
|
$line_limit = $_POST['line_limit'];
|
|
|
|
if ($line_limit) {
|
|
|
|
$llflag = "--line_limit $line_limit";
|
|
|
|
}
|
|
|
|
|
|
|
|
Header("Location: sim/sim_out_0.html");
|
|
|
|
$cmd = "./sim --duration $duration --delta $delta $suw $dcfflag $rr_only $work_fetch_old $llflag";
|
|
|
|
system("/bin/rm sim_log.txt sim_out_*.html");
|
2007-05-15 20:47:42 +00:00
|
|
|
system($cmd);
|
|
|
|
} 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();
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|