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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
# $Id$
#
# Plots two lines, with min-max ranges, from two DYN.LCL.tbl files.
#
# The first three lines above let this script run without specifying the
# full path to perl, as long as it is in the user's PATH.
# Taken from perlrun man page.
$usage="usage: $0 <first .tbl> <second .tbl>\n";
########
######## Process command line args.
########
while ( $#ARGV >= $[ && $ARGV[0] =~ /^-/ ) {
if ( $ARGV[0] eq '-?' ) {
print "$usage";
exit;
} else {
print STDERR "$0: unknown option $ARGV[0]\n";
die $usage;
}
shift;
}
die "$usage" unless $#ARGV == 1;
$tbl1 = $ARGV[0];
$tbl2 = $ARGV[1];
########
######## Plot separately for each number of suppliers.
########
&plot (1);
sub extract {
my ($input, $suppliers, $output) = (@_);
open (INPUT, "$input") || die "$0: unable to open $input\n";
open (OUTPUT, "> $output") || die "$0: unable to open $output\n";
while (<INPUT>) {
if (/^$suppliers (\d+) ([\d.]+) ([\d.]+) (\d+) (\d+)/) {
print OUTPUT "$1 $4 $2 $3\n";
}
}
close OUTPUT;
close INPUT;
}
sub plot {
my ($suppliers) = (@_);
&extract ("$tbl1", $suppliers, "tmpS$suppliers-rms");
&extract ("$tbl2", $suppliers, "tmpS$suppliers-muf");
open (GNUPLOT, "| gnuplot") || die "$0: unable to open gnuplot\n";
print GNUPLOT "set xlabel 'Number of Consumers'\n";
print GNUPLOT "set ylabel 'Latency, usec'\n";
print GNUPLOT "set terminal postscript eps color\n";
print GNUPLOT "set output 'DYN.plot-S$suppliers.eps'\n";
print GNUPLOT "plot " .
"'tmpS$suppliers-rms' title 'RMS' w lines, " .
"'tmpS$suppliers-rms' using (\$1-0.05):2:3:4 " .
"notitle w errorbars, " .
"'tmpS$suppliers-muf' title 'MUF' w lines, " .
"'tmpS$suppliers-muf' using (\$1+0.05):2:3:4 " .
"notitle w errorbars\n";
close GNUPLOT;
unlink "tmpS$suppliers-rms", "tmpS$suppliers-muf";
}
|