File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ipsec-tools / src / racoon / stats.pl
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 22:39:10 2012 UTC (12 years, 10 months ago) by misho
CVS tags: MAIN, HEAD
Initial revision

#!/usr/bin/perl
# usage:
# % cat /var/log/racoon-stats.log | perl stats.pl

while(<STDIN>) {
	chomp;
	($a, $a, $a, $a, $a, $b) = split(/\s+/, $_, 6);
	($a, $c) = split(/:/, $b, 2);
	$r{$a} += $c;
	$t{$a}++;
}

foreach (sort keys %t) {
	printf "%s: total=%d avg=%8.6f\n", $_, $t{$_}, $r{$_}/$t{$_};
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>