Filter tcpdump output and convert to time/seq# graph.

This commit is contained in:
hjp 1999-02-18 12:56:56 +00:00
parent ebf06b92be
commit e1cfcab81e
1 changed files with 30 additions and 0 deletions

30
tcpdump_tools/tcpdumptognuplot Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/perl
$count = $ack = $prevtime = 0;
while (<STDIN>) {
if (/${ARGV[0]}/) {
print "# ", $_;
# 20:22:42.441592 calypso.wsr.ac.at.ftp-data > octopussy.wsr.ac.at.1365: . 1:1461(1460) ack 1 win 57344 (DF)
if (/^(\d\d):(\d\d):(\d\d).(\d\d\d\d\d\d) /) {
print "# time: $1 $2 $3 $4\n";
$time = $1 * 3600 + $2 * 60 + $3 + $4 * 0.000001;
if ($prevtime == 0) { $prevtime = $time };
$time -= $prevtime;
}
if (/(\d+):(\d+)\((\d+)\)/) {
print "# sequence: $1 $2 $3\n";
# filter out initial seq. number but allow some packet loss
if ($2 == $1 + $3 && $1 <= $count + 300000) {
$count = $2;
}
}
if (/ ack (\d+)/) {
print "# ack: $1\n";
# filter out initial seq. number but allow some packet loss
if ($1 <= $ack + 300000) {
$ack = $1;
}
}
print $time, "\t", $count, "\t", $ack, "\n";
}
}