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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.