#!/usr/bin/perl use warnings; use strict; my %data; my %report; while () { chomp; my ($pid, $op, $time) = split /\s/; if ($op eq 'signalled') { push @{$data{$pid}}, $time; } else { my $sigtime = pop @{$data{$pid}}; push @{$report{$pid}}, $time - $sigtime; } } print "Summary".$/; print "Lost:".$/; foreach my $pid (sort keys %data) { print $pid.": ".scalar(@{$data{$pid}}).$/; } print "Received: ".$/; foreach my $pid (sort keys %report) { my ($min, $max, $count, $sum); foreach my $time (@{$report{$pid}}) { $min = $time if (not defined $min or $min > $time); $max = $time if (not defined $max or $max < $time); $count++; $sum += $time; } print $pid.": $max, $min, $count, ".$sum/$count.$/; }