#!/usr/local/bin/perl -w
$FileSearch = '-1.txt';
$FileIndex = 1;
$Runs = 5;
$Debug = 0;
@Methods = ('ft', 'cv');
sub showBody
{
local($output) = @_;
print $output <<"END_OF_HEAD";
Summary of Test Runs with Automatic Generated Xplots
The following data is a compilation of tcpdumps taken with different client/server
combinations. Each testrun generates three data sets: HTTP/1.0, HTTP/1.1, and HTTP pipelining.
Naming Scheme
The names of the runs are named as follows:
<SERVER> - <BANDWIDTH> - <LATENCY> - <HTTP CLIENT VERSION>
- SERVER
- J stands for jigsaw and A stands for Apache. The number is for us to keep track of which version of each we are trying.
- BANDWIDTH
- H stands for high (for example a LAN) and L stands for low, for example PPP
- LATENCY
- H stands for high latency, for example WAN) and L stands for low, for example LAN
- HTTP CLIENT VERSION
- These are the suffixes used: http-10 is plain HTTP/1.0, http-11 is without pipelining, http-11-pl is with pipelining, and http-11-pl-zip is HTTP/1.1 with pipelining and deflate content encoding.
Each combination is run 5 times and each run consists of a first time retrieval followed by a cache validation. That is in all 10 times pr combination. We use this for naming the results:
- ft (first time - grabbing documents and headers)
- cv (cash validation - just getting the headers)
As an example, take the following name:
A1-LH-http-11
- The server is Apache
- The bandwidth is low
- The latency is high
- The requests are non-pipelined HTTP/1.1
Data Summary
The data is furthur summarized at the end of this file.
END_OF_HEAD
}
sub endBody
{
local($output) = @_;
print $output "
\n";
print $output "\n";
print $output "\n\nid | \n";
foreach $method (@Methods) {
print $output <<"END_OF_SUMMARY_HEAD";
$method\npackets |
bytes |
time |
TCP Overhead in % |
END_OF_SUMMARY_HEAD
}
print $output "
\n";
foreach $dir (@ARGV) {
print $output "\n$dir | \n";
foreach $method (@Methods) {
local ($key) = ($dir.'.'.$method);
if (defined $AvgPackets{$key}) {
printf $output "%.1f | \n%.1f | \n%.2f | \n%.1f | \n", $AvgPackets{$key}, $AvgBytes{$key}, $AvgTime{$key}, $AvgEffic{$key};
} else {
print $output " | \n | \n | \n | \n";
}
}
print $output "
\n";
}
$date = `date`;
print $output "
Generated on $date\n";
print $output "\n\n";
}
sub showProtocol
{
local($output, $protocol) = @_;
print $output <<"END_OF_PROTOCOL";
END_OF_PROTOCOL
}
sub endProtocol
{
local($output, $method, $protocol) = @_;
local ($key) = "$protocol.$method";
$AvgPackets /= $Runs;
$AvgBytes /= $Runs;
$AvgTime /= $Runs;
$AvgEffic /= $Runs;
$AvgEffic = 100 * (1-$AvgEffic);
printf "$key: %.1f packets %d bytes took %.3f - overhead: %.1f%%\n", $AvgPackets, $AvgBytes, $AvgTime, $AvgEffic;
printf $output "average: %.1f packets %d bytes took %.3f - overhead: %.1f%%\n",
$AvgPackets, $AvgBytes, $AvgTime, $AvgEffic;
($AvgPackets{$key}, $AvgBytes{$key}, $AvgTime{$key}, $AvgEffic{$key}) =
($AvgPackets, $AvgBytes, $AvgTime, $AvgEffic);
print $output "\n";
}
sub showMethod
{
local($output, $method, $protocol) = @_;
print $output <<"END_OF_METHOD";
END_OF_METHOD
}
sub endMethod
{
local($output, $method, $protocol) = @_;
print $output "\n";
}
sub showRun
{
local($output, $run, $method, $protocol) = @_;
print $output <<"END_OF_RUN";
run-$run
Host and port (Raw dump) |
Packets |
Bytes |
Time |
TCP Overhead in % |
END_OF_RUN
}
sub endRun
{
local($output, $method, $protocol) = @_;
print $output "
\n";
}
sub showLine
{
local($output, $line, $run, $method, $protocol) = @_;
local($from, $to, $mode, $xplot, $packets, $bytes, $time, $effic) = split(' ', $line);
print $output "
\n";
print $output "" if ($mode eq 'server');
print $output "$from";
print $output "" if ($mode eq 'server');
print $output "\n | \n$packets | \n";
print $output "$bytes | \n";
printf $output "%.3f | \n", $time;
warn "$protocol $method $run: can't parse \"$line\".\n" if (!defined $effic);
printf $output "%.1f | \n", 100 * (1-$effic);
print $output "
\n";
}
sub showSummary
{
local($output, $summary, $run, $method, $protocol) = @_;
local($id, $packets, $bytes, $time, $effic) = split(' ', $summary);
$AvgPackets += $packets;
$AvgBytes += $bytes;
$AvgTime += $time;
$AvgEffic += $effic;
print $output "\n";
print $output "-total- | \n";
print $output "$packets | \n";
print $output "$bytes | \n";
printf $output "%.3f | \n", $time;
printf $output "%.1f | \n", 100 * (1-$effic);
print $output "
\n";
}
if ($ARGV[0] eq '-d') {
$Debug = 1;
shift @ARGV;
}
open(HTML, '>summary.html') || die "iter: Couldn't open summary file \"summary.html\" for writing: $!.\n";
&showBody('HTML');
foreach $dir (@ARGV) {
chop $dir if ($dir =~ /.*\/$/);
if (!open(ONES, "cd $dir && ls *$FileSearch |")) {
warn "iter: Couldn't run 'ls \"*$FileSearch\"': $!.\n";
next;
}
&showProtocol('HTML', $dir);
foreach $file () {
chop $file;
$i = index($file, $FileSearch);
next if ($i == $[ - 1);
$i += $FileIndex;
$AvgPackets = 0;
$AvgBytes = 0;
$AvgTime = 0;
$AvgEffic = 0;
$method = substr($file, $i-3, 2);
&showMethod('HTML', $method, $dir);
foreach $run (1 .. $Runs) {
substr($file, $i, 1) = $run;
local ($base) = substr($file, 0, index($file, '-'));
$command = "cd $dir && ../tcpdump2xplot.pl -q -s -f -c -listlist -plot'\"".$base."-\".\$from[0].\":\".\$fromPort.\"-\".\$to[0].\":\".\$toPort.\".$method-$run.\".xplot' $file";
if ($Debug) {
print $command, "\n";
next;
}
if (!open(CMD, "$command |")) {
warn "iter: Couldn't run '$command': $!.\n";
next;
}
while () {
print;
}
open(LIST, "<$dir/list") || die "iter: Couldn't open \"$dir/list\" for reading: $!.\n";
&showRun('HTML', $run, $method, $dir);
while () {
chop;
if (/^summary: /) {
&showSummary('HTML', $_, $run, $method, $dir)
} else {
&showLine('HTML', $_, $run, $method, $dir);
}
}
&endRun('HTML', $run, $method, $dir);
}
&endProtocol('HTML', $method, $dir);
}
&endMethod('HTML', $dir);
}
&endBody('HTML');
close(HTML);