mirror of https://github.com/BOINC/boinc.git
- storage simulator work
svn path=/trunk/boinc/; revision=25107
This commit is contained in:
parent
c27a896fff
commit
5eb5bf5228
|
@ -749,3 +749,10 @@ Charlie 19 Jan 2012
|
|||
clientgui/
|
||||
mac/
|
||||
SetupSecurity.cpp
|
||||
|
||||
David 19 Jan 2012
|
||||
- storage simulator work
|
||||
|
||||
ssim/
|
||||
ssim.cpp
|
||||
ssim.php
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
// [--host_life_mean x]
|
||||
// [--connect_interval x]
|
||||
// [--mean_xfer_rate x]
|
||||
// [--file_size x]
|
||||
//
|
||||
// outputs:
|
||||
// stdout: log info
|
||||
|
@ -76,6 +77,8 @@ struct PARAMS {
|
|||
double host_life_mean;
|
||||
double connect_interval;
|
||||
double mean_xfer_rate;
|
||||
double file_size;
|
||||
double sim_duration;
|
||||
|
||||
int replication;
|
||||
int coding_levels;
|
||||
|
@ -87,6 +90,8 @@ struct PARAMS {
|
|||
host_life_mean = 100.*86400;
|
||||
connect_interval = 86400.;
|
||||
mean_xfer_rate = .2e6;
|
||||
file_size = 1e12;
|
||||
sim_duration = 1000.*86400;
|
||||
coding_levels = 1;
|
||||
codings[0].n = 10;
|
||||
codings[0].k = 6;
|
||||
|
@ -96,11 +101,13 @@ struct PARAMS {
|
|||
}
|
||||
int parse_policy(const char* filename) {
|
||||
int n;
|
||||
char buf[256];
|
||||
FILE* f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "No policy file %s\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
fgets(buf, sizeof(buf), f); // title
|
||||
n = fscanf(f, "%d", &replication);
|
||||
if (n != 1) {
|
||||
fprintf(stderr, "parse error in %s\n", filename);
|
||||
|
@ -976,6 +983,8 @@ int main(int argc, char** argv) {
|
|||
p.connect_interval = atof(argv[++i]);
|
||||
} else if (!strcmp(argv[i], "--mean_xfer_rate")) {
|
||||
p.mean_xfer_rate = atof(argv[++i]);
|
||||
} else if (!strcmp(argv[i], "--file_size")) {
|
||||
p.file_size = atof(argv[++i]);
|
||||
} else {
|
||||
fprintf(stderr, "bad arg %s\n", argv[i]);
|
||||
exit(1);
|
||||
|
@ -992,10 +1001,10 @@ int main(int argc, char** argv) {
|
|||
sim.insert(new HOST);
|
||||
}
|
||||
#endif
|
||||
DFILE* dfile = new DFILE(1e12);
|
||||
DFILE* dfile = new DFILE(p.file_size);
|
||||
sim.insert(dfile);
|
||||
|
||||
sim.simulate(1000*86400);
|
||||
sim.simulate(p.sim_duration);
|
||||
|
||||
printf("%s: simulation finished\n", now_str());
|
||||
dfile->print_stats();
|
||||
|
|
|
@ -16,18 +16,24 @@ function parse_input_file($filename) {
|
|||
$x = null;
|
||||
$x->name = $filename;
|
||||
$x->policy = array();
|
||||
$x->policy_name = array();
|
||||
$f = fopen($filename, "r");
|
||||
if (!$f) die("no file $filename\n");
|
||||
while (($buf = fgets($f)) !== false) {
|
||||
$w = explode(" ", $buf);
|
||||
switch ($w[0]) {
|
||||
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;
|
||||
case "host_life_mean":
|
||||
$x->host_life_mean = array();
|
||||
for ($i=1; $i<count($w); $i++) {
|
||||
$x->host_life_mean[] = (double)($w[$i]);
|
||||
$x->host_life_mean[] = 86400 * (double)($w[$i]);
|
||||
}
|
||||
break;
|
||||
case "connect_interval":
|
||||
|
@ -36,6 +42,9 @@ function parse_input_file($filename) {
|
|||
case "mean_xfer_rate":
|
||||
$x->mean_xfer_rate = (double)($w[1]);
|
||||
break;
|
||||
case "file_size":
|
||||
$x->file_size = (double)($w[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose($f);
|
||||
|
@ -46,19 +55,20 @@ function make_graph($input, $prefix, $title, $index) {
|
|||
$gp_filename = $input->name."_$prefix.gp";
|
||||
$f = fopen($gp_filename, "w");
|
||||
fprintf($f, "set terminal png small size 1024, 768
|
||||
set title \"$title\"
|
||||
set yrange[0:]
|
||||
");
|
||||
set ylabel \"$title\"
|
||||
set xlabel \"Mean host lifetime (days)\"
|
||||
plot ");
|
||||
$n = sizeof($input->policy);
|
||||
$i = 0;
|
||||
foreach ($input->policy as $p) {
|
||||
for ($i=0; $i<$n; $i++) {
|
||||
$p = $input->policy[$i];
|
||||
$pname = $input->policy_name[$i];
|
||||
$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) {
|
||||
fprintf($f, ", \\");
|
||||
}
|
||||
fprintf($f, "\n");
|
||||
$i++;
|
||||
}
|
||||
fclose($f);
|
||||
$png_filename = $input->name."_$prefix.png";
|
||||
|
@ -89,18 +99,20 @@ foreach ($input->policy as $p) {
|
|||
die("no policy file '$p'\n");
|
||||
}
|
||||
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";
|
||||
system($cmd);
|
||||
list($du, $ul, $dl, $ft) = parse_output_file("summary.txt");
|
||||
fprintf($datafile, "$hlm $du $ul $dl $ft\n");
|
||||
list($ft, $du, $ub, $db) = parse_output_file("summary.txt");
|
||||
$hlmd = $hlm/86400;
|
||||
$du_rel = $du/$input->file_size;
|
||||
fprintf($datafile, "$hlmd $ft $du_rel $ub $db\n");
|
||||
}
|
||||
fclose($datafile);
|
||||
}
|
||||
|
||||
make_graph($input, "du", "Disk usage", 2);
|
||||
make_graph($input, "ub", "Upload bandwidth", 3);
|
||||
make_graph($input, "db", "Download bandwidth", 4);
|
||||
make_graph($input, "ft", "Fault tolerance", 5);
|
||||
make_graph($input, "ft", "Fault tolerance", 2);
|
||||
make_graph($input, "du", "Relative disk usage", 3);
|
||||
make_graph($input, "ub", "Upload bandwidth (Mbps)", 4);
|
||||
make_graph($input, "db", "Download bandwidth (Mbps)", 5);
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue