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

#!/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>