# Given a number of bytes, return a suitable descriptive string
# such as "983 b" or "12 Mb".
sub pbytes {
  my $bytes = shift;
  my @prefix = ('', 'k', 'M', 'G', 'T');
  my $power = 0;
  until ($bytes < 10000 || $power == $#prefix) {
    $bytes /= 1024;
    $power++;
  }
  int($bytes+.5) . " $prefix[$power]b";
}
