2 # Draw graphs of IP traffic from netgrind histograms
3 # (c) 2003 Martin Mares <mj@ucw.cz>, GPL'ed
9 my $datafile = "gp.tmp";
10 open D, ">$datafile" or die;
13 my @ewma = ( 0, 0, 0, 0, 0 );
21 @colnames = split /\t/;
25 my %row = map { $colnames[$i++] => $_ } split /\t/;
26 my $time = POSIX::strftime("%d-%m-%Y %H:%M:%S", localtime $row{'time'});
29 ($row{'IPBad'} + $row{'IPBadSum'}) / $w,
35 for (my $i=0; $i<=$#r; $i++) {
36 $ewma[$i] = $ew*$ewma[$i] + $eww*$r[$i];
37 print D "\t", $ewma[$i];
44 open GP, "|gnuplot" or die;
49 set title "IP packet spectrum"
51 set ylabel "Packets / s [EWMA $ew]"
53 set timefmt "%d-%m-%Y %H:%M:%S"
54 set format x "%d/%m\\n%H:%M"
57 plot "$datafile" using 1:3 title "All IP packets", \\
58 "$datafile" using 1:4 title "Bad IP header", \\
59 "$datafile" using 1:5 title "Non-TCP", \\
60 "$datafile" using 1:6 title "Fragmented TCP", \\
61 "$datafile" using 1:7 title "Processed TCP"