10 my (@x) = split /\s+/, $_;
12 my $num_packets = scalar @x;
13 my $num_drops = grep { /\*/ } @x;
15 $buckets{$num_packets}->{'num_bursts'}++;
16 $buckets{$num_packets}->{'num_drops'} += $num_drops;
18 $buckets{$num_packets}->{'bursts_with_drops'}++;
22 for my $n (sort { $a <=> $b } keys %buckets) {
23 my $num_bursts = $buckets{$n}->{'num_bursts'} // 0;
24 my $num_drops = $buckets{$n}->{'num_drops'} // 0;
25 my $bursts_with_drops = $buckets{$n}->{'bursts_with_drops'} // 0;
27 my $drop_rate = $num_drops / ($n * $num_bursts);
28 my $drop_event_rate = $bursts_with_drops / $num_bursts;
29 printf "%3d: drop_rate %.5f (%4d/%8d) drop_event_rate %.5f (%3d/%4d)\n",
30 $n, $drop_rate, $num_drops, $n * $num_bursts,
31 $drop_event_rate, $bursts_with_drops, $num_bursts;