-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy pathblock-plot.pl
executable file
·58 lines (49 loc) · 1.17 KB
/
block-plot.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/local/bin/perl
# ./block-plot.pl [store|fetch] [10|100] < [inputfile] | gnuplot | gv -
$cursize = 0;
$curblocks = 0;
$stime = 0;
$ftime = 0;
if(@ARGV != 2) {
die "usage: block-plot.pl choose_fetch_or_store choose_#_blocks\n";
}
$fs = $ARGV[0];
$nblocks = $ARGV[1];
print "set terminal postscript default\n";
print "set title '$fs with $nblocks blocks'\n";
print "set xlabel 'block size'\n";
print "set ylabel 'throughput kB/s'\n";
print "plot '-' with lines\n";
while(<STDIN>) {
chomp;
if(/^(.+) (.+) (.+) (.+)/) {
if(($cursize == $1) &&
($curblocks == $2)) {
$stime += $3;
$ftime += $4;
} else {
if(($stime != 0) &&
($curblocks == $nblocks)) {
if($fs eq 'fetch') {
$avgtime = $cursize*$curblocks / ($ftime / 1000);
} else {
$avgtime = $cursize*$curblocks / ($stime / 1000);
}
print "$cursize $avgtime\n";
}
$cursize = $1;
$curblocks = $2;
$stime = $3;
$ftime = $4;
}
} else {
print "$_\n";
}
}
if($fs eq 'fetch') {
$avgtime = $cursize*$curblocks / ($ftime / 1000);
} else {
$avgtime = $cursize*$curblocks / ($stime / 1000);
}
print "$cursize $avgtime\n";
print "e\nquit\n";