Next | Trivial Utilities | 36 |
printf "%.2f", $fl/66 if $opt_p && $opt_l; printf "%s/s", rate(($fl-$fl1)/($time -$^T)) if $time > $^T && $opt_r;
Now what is this all about?
Apparently -pl prints the report in pages instead of lines
Apparently -r prints the rate at which data is arriving in the file
Here is the absurdly overengineered rate function:
sub rate { my $r = shift; my @m = (1000000000, 1000000, 1000, 1, .0001, .0000001); my @l = ('G', 'M', 'k', '', 'm', 'u'); for (0 .. $#m) { if ($r >= $m[$_]) { return sprintf "%.2f%s", $r/$m[$_], $l[$_]; } } }
The rate comes out as something like 13.23k/s
To support this, the program must track $fl1
I had forgotten all about this until I started writing this class
Oh well
Next | Menu | Copyright © 2012 M. J. Dominus |