Tuna has asked for the wisdom of the Perl Monks concerning the following question:

This is more of a stats problem than it is a Perl problem, so I'm ready to take my lumps if the monks deem it necessary.

This script needs to compute average bandwidth utilization over a period of N years, and at X growth, as specified on the command line.

What we know:

1. 95th. percentile = 1.6 * average traffic.
2. When 95th. percentile reaches %80, we quadruple capacity.
In simple mathematical terms, when 1.6 * avg. traffic = .8/capacity, we quadruple capacity.

So, here's some code:
#!/usr/local/bin/perl -w use strict; use POSIX; my $pct = $ARGV[0]; my $number_of_years = $ARGV[1]; my $beg_cap = 155; my $beg_traffic = (.5 * $beg_cap); my $m = (1 + $pct/100); die "Usage: $0 <yearly growth percentage> <number of years>\n" unless +@ARGV ==2; die "Not a valid percentage\n" unless($pct =~ m/\d+$/); die "Not a valid year\n" unless ($year =~ m/\d+$/); my $future_traffic = (($m**($number_of_years)) * ($beg_traffic)); print "future traffic: $future_traffic\n"; my $time_until_next_quadruple_cap = ((log(4)) / (log($m))); print "time in years until next 4x increase: $time_until_next_quadrupl +e_cap\n"; my $number_of_times_quadrupled = ceil($time_until_next_quadruple_cap); print "number of times: $number_of_times_quadrupled\n"; my $new_cap = (4**($number_of_times_quadrupled)); print "new capacity = $new_cap\n"; my $abs_cap = (($new_cap * $beg_cap)); print "absolute capacity = $abs_cap MBpS\n"; my $util = (($future_traffic) / ($abs_cap) *.2705); my $utilpct = ($util * 100); print "avg. utilization = %$utilpct \n";
Anyone?

Replies are listed 'Best First'.
Re: Computing Average Utilization
by Tuna (Friar) on Feb 20, 2001 at 02:07 UTC
    There was an error in the code that I just posted. The line:
    die "Not a valid year\n" unless ($year =~ m/\d+$/);
    should read:
    die "Not a valid year\n" unless ($number_of_years =~ m/\d+$/);