From 624752306b59c1cd6c1f008d60fc7975ad01b7b4 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 28 May 2012 15:16:43 +0200 Subject: [PATCH] Cleanup in summarize.pl. --- summarize.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/summarize.pl b/summarize.pl index 813023d..917c548 100755 --- a/summarize.pl +++ b/summarize.pl @@ -20,8 +20,12 @@ while (<>) { } for my $n (sort { $a <=> $b } keys %buckets) { - my $drop_rate = $buckets{$n}->{'num_drops'} / ($n * $buckets{$n}->{'num_bursts'}); - my $drop_event_rate = ($buckets{$n}->{'bursts_with_drops'} // 0) / $buckets{$n}->{'num_bursts'}; + my $num_bursts = $buckets{$n}->{'num_bursts'} // 0; + my $num_drops = $buckets{$n}->{'num_drops'} // 0; + my $bursts_with_drops = $buckets{$n}->{'bursts_with_drops'} // 0; + + my $drop_rate = $num_drops / ($n * $num_bursts); + my $drop_event_rate = $bursts_with_drops / $num_bursts; printf "%3d: drop_rate %.5f drop_event_rate %.5f\n", $n, $drop_rate, $drop_event_rate; } -- 2.39.2