[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] another quickie report
Given data like this:
2006-10-16 00:00:00,298 (Pairs.pm:231)> HD 00 180353311CF983
[AUSSTH|18OCT06|22OCT06|4] [PALSRQ|ERRRP-DEEIND-ERC10|Omni Farm]
0.350898
2006-10-16 00:00:04,515 (Pairs.pm:231)> 1P 1P 0A1953311D3112
[CANCUN|02NOV06|05NOV06|3] [PALSRQ|PALSRP|Omni Farm] 1.202273
Create a report like this:
BOOKRQ BOOKRP 5547 messages averaging 1.57 seconds each
AALSRQ AALSRP 8946 messages averaging 0.73 seconds each
PALSRQ ERRRP 64200 messages averaging 0.69 seconds each
PALSRQ PALSRP 99857 messages averaging 1.20 seconds each
RPINRQ RPINRP 12294 messages averaging 0.59 seconds each
Solution:
while (<>) {
my ($in, $out, $time) = /\[.*\] \[(\w+)\|(\w+).*(\d+\.\d+)/;
next unless $in;
$stats{$in}{$out}{total} += $time;
$stats{$in}{$out}{cnt}++;
}
my ($in, $out);
foreach $in (keys %stats) {
foreach $out (keys %{$stats{$in}}) {
$cnt = $stats{$in}{$out}{cnt};
$total = $stats{$in}{$out}{total};
printf("%s %s %d messages averaging %0.2f seconds each\n",
$in, $out, $cnt, $total / $cnt);
}
}