- storage simulator work

svn path=/trunk/boinc/; revision=25107
This commit is contained in:
David Anderson 2012-01-19 20:11:52 +00:00
parent c27a896fff
commit 5eb5bf5228
3 changed files with 45 additions and 17 deletions

View File

@ -749,3 +749,10 @@ Charlie 19 Jan 2012
clientgui/ clientgui/
mac/ mac/
SetupSecurity.cpp SetupSecurity.cpp
David 19 Jan 2012
- storage simulator work
ssim/
ssim.cpp
ssim.php

View File

@ -24,6 +24,7 @@
// [--host_life_mean x] // [--host_life_mean x]
// [--connect_interval x] // [--connect_interval x]
// [--mean_xfer_rate x] // [--mean_xfer_rate x]
// [--file_size x]
// //
// outputs: // outputs:
// stdout: log info // stdout: log info
@ -76,6 +77,8 @@ struct PARAMS {
double host_life_mean; double host_life_mean;
double connect_interval; double connect_interval;
double mean_xfer_rate; double mean_xfer_rate;
double file_size;
double sim_duration;
int replication; int replication;
int coding_levels; int coding_levels;
@ -87,6 +90,8 @@ struct PARAMS {
host_life_mean = 100.*86400; host_life_mean = 100.*86400;
connect_interval = 86400.; connect_interval = 86400.;
mean_xfer_rate = .2e6; mean_xfer_rate = .2e6;
file_size = 1e12;
sim_duration = 1000.*86400;
coding_levels = 1; coding_levels = 1;
codings[0].n = 10; codings[0].n = 10;
codings[0].k = 6; codings[0].k = 6;
@ -96,11 +101,13 @@ struct PARAMS {
} }
int parse_policy(const char* filename) { int parse_policy(const char* filename) {
int n; int n;
char buf[256];
FILE* f = fopen(filename, "r"); FILE* f = fopen(filename, "r");
if (!f) { if (!f) {
fprintf(stderr, "No policy file %s\n", filename); fprintf(stderr, "No policy file %s\n", filename);
exit(1); exit(1);
} }
fgets(buf, sizeof(buf), f); // title
n = fscanf(f, "%d", &replication); n = fscanf(f, "%d", &replication);
if (n != 1) { if (n != 1) {
fprintf(stderr, "parse error in %s\n", filename); fprintf(stderr, "parse error in %s\n", filename);
@ -976,6 +983,8 @@ int main(int argc, char** argv) {
p.connect_interval = atof(argv[++i]); p.connect_interval = atof(argv[++i]);
} else if (!strcmp(argv[i], "--mean_xfer_rate")) { } else if (!strcmp(argv[i], "--mean_xfer_rate")) {
p.mean_xfer_rate = atof(argv[++i]); p.mean_xfer_rate = atof(argv[++i]);
} else if (!strcmp(argv[i], "--file_size")) {
p.file_size = atof(argv[++i]);
} else { } else {
fprintf(stderr, "bad arg %s\n", argv[i]); fprintf(stderr, "bad arg %s\n", argv[i]);
exit(1); exit(1);
@ -992,10 +1001,10 @@ int main(int argc, char** argv) {
sim.insert(new HOST); sim.insert(new HOST);
} }
#endif #endif
DFILE* dfile = new DFILE(1e12); DFILE* dfile = new DFILE(p.file_size);
sim.insert(dfile); sim.insert(dfile);
sim.simulate(1000*86400); sim.simulate(p.sim_duration);
printf("%s: simulation finished\n", now_str()); printf("%s: simulation finished\n", now_str());
dfile->print_stats(); dfile->print_stats();

View File

@ -16,18 +16,24 @@ function parse_input_file($filename) {
$x = null; $x = null;
$x->name = $filename; $x->name = $filename;
$x->policy = array(); $x->policy = array();
$x->policy_name = array();
$f = fopen($filename, "r"); $f = fopen($filename, "r");
if (!$f) die("no file $filename\n"); if (!$f) die("no file $filename\n");
while (($buf = fgets($f)) !== false) { while (($buf = fgets($f)) !== false) {
$w = explode(" ", $buf); $w = explode(" ", $buf);
switch ($w[0]) { switch ($w[0]) {
case "policy": case "policy":
$x->policy[] = trim($w[1]); $pfile = trim($w[1]);
$x->policy[] = $pfile;
$g = fopen($pfile, "r");
$name = fgets($g);
fclose($g);
$x->policy_name[] = trim($name);
break; break;
case "host_life_mean": case "host_life_mean":
$x->host_life_mean = array(); $x->host_life_mean = array();
for ($i=1; $i<count($w); $i++) { for ($i=1; $i<count($w); $i++) {
$x->host_life_mean[] = (double)($w[$i]); $x->host_life_mean[] = 86400 * (double)($w[$i]);
} }
break; break;
case "connect_interval": case "connect_interval":
@ -36,6 +42,9 @@ function parse_input_file($filename) {
case "mean_xfer_rate": case "mean_xfer_rate":
$x->mean_xfer_rate = (double)($w[1]); $x->mean_xfer_rate = (double)($w[1]);
break; break;
case "file_size":
$x->file_size = (double)($w[1]);
break;
} }
} }
fclose($f); fclose($f);
@ -46,19 +55,20 @@ function make_graph($input, $prefix, $title, $index) {
$gp_filename = $input->name."_$prefix.gp"; $gp_filename = $input->name."_$prefix.gp";
$f = fopen($gp_filename, "w"); $f = fopen($gp_filename, "w");
fprintf($f, "set terminal png small size 1024, 768 fprintf($f, "set terminal png small size 1024, 768
set title \"$title\"
set yrange[0:] set yrange[0:]
"); set ylabel \"$title\"
set xlabel \"Mean host lifetime (days)\"
plot ");
$n = sizeof($input->policy); $n = sizeof($input->policy);
$i = 0; for ($i=0; $i<$n; $i++) {
foreach ($input->policy as $p) { $p = $input->policy[$i];
$pname = $input->policy_name[$i];
$fname = $input->name."_$p.dat"; $fname = $input->name."_$p.dat";
fprintf($f, "plot \"$fname\" using 1:$index title \"$p\" with lines"); fprintf($f, "\"$fname\" using 1:$index title \"$pname\" with lines");
if ($i < $n-1) { if ($i < $n-1) {
fprintf($f, ", \\"); fprintf($f, ", \\");
} }
fprintf($f, "\n"); fprintf($f, "\n");
$i++;
} }
fclose($f); fclose($f);
$png_filename = $input->name."_$prefix.png"; $png_filename = $input->name."_$prefix.png";
@ -89,18 +99,20 @@ foreach ($input->policy as $p) {
die("no policy file '$p'\n"); die("no policy file '$p'\n");
} }
foreach ($input->host_life_mean as $hlm) { foreach ($input->host_life_mean as $hlm) {
$cmd = "ssim --policy $p --host_life_mean $hlm --connect_interval $input->connect_interval --mean_xfer_rate $input->mean_xfer_rate > /dev/null"; $cmd = "ssim --policy $p --host_life_mean $hlm --connect_interval $input->connect_interval --mean_xfer_rate $input->mean_xfer_rate --file_size $input->file_size > /dev/null";
echo "$cmd\n"; echo "$cmd\n";
system($cmd); system($cmd);
list($du, $ul, $dl, $ft) = parse_output_file("summary.txt"); list($ft, $du, $ub, $db) = parse_output_file("summary.txt");
fprintf($datafile, "$hlm $du $ul $dl $ft\n"); $hlmd = $hlm/86400;
$du_rel = $du/$input->file_size;
fprintf($datafile, "$hlmd $ft $du_rel $ub $db\n");
} }
fclose($datafile); fclose($datafile);
} }
make_graph($input, "du", "Disk usage", 2); make_graph($input, "ft", "Fault tolerance", 2);
make_graph($input, "ub", "Upload bandwidth", 3); make_graph($input, "du", "Relative disk usage", 3);
make_graph($input, "db", "Download bandwidth", 4); make_graph($input, "ub", "Upload bandwidth (Mbps)", 4);
make_graph($input, "ft", "Fault tolerance", 5); make_graph($input, "db", "Download bandwidth (Mbps)", 5);
?> ?>