Subversion Repositories LCARS

Rev

Rev 48 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 48 Rev 49
Line 88... Line 88...
88
88
89
## FIXME: Why don't the defaults work already?
89
## FIXME: Why don't the defaults work already?
90
my $formatter = new Number::Format(
90
my $formatter = new Number::Format(
91
  -decimal_point => $decimal_point,
91
  -decimal_point => $decimal_point,
92
  -thousands_sep => $thousands_sep,
92
  -thousands_sep => $thousands_sep,
-
 
93
  -kibi_suffix   => ' KiB',
-
 
94
  -mebi_suffix   => ' MiB',
-
 
95
  -gibi_suffix   => ' GiB',
-
 
96
93
  # -grouping      => $grouping[0]
97
  # -grouping      => $grouping[0]
94
);
98
);
95
99
96
###################### USER CONFIGURATIONS ############################
100
###################### USER CONFIGURATIONS ############################
97
101
Line 614... Line 618...
614
    __(
618
    __(
615
"(compiled with a script by Thomas 'PointedEars' Lahn, based on work by\nGarry Knight et al.)"
619
"(compiled with a script by Thomas 'PointedEars' Lahn, based on work by\nGarry Knight et al.)"
616
    ),
620
    ),
617
    76
621
    76
618
    );
622
    );
619
  print "\n\n";
623
  print "\n";
620
  printf __"Total articles considered: %s over %d days\n",
624
  printf __"Total articles considered:   %s over %d days\n",
621
    $formatter->format_number($totalposts),
625
    $formatter->format_number($totalposts),
622
    $formatter->format_number($numdays);
626
    $formatter->format_number($numdays);
623
  my $time_locale       = setlocale(LC_TIME);
627
  my $time_locale       = setlocale(LC_TIME);
624
  my $earliest_datetime = DateTime->from_epoch(
628
  my $earliest_datetime = DateTime->from_epoch(
625
    epoch     => $earliest,
629
    epoch     => $earliest,
Line 630... Line 634...
630
    epoch     => $latest,
634
    epoch     => $latest,
631
    locale    => $time_locale,
635
    locale    => $time_locale,
632
    time_zone => 'UTC',
636
    time_zone => 'UTC',
633
  );
637
  );
634
  my $datetime_format = '%a, %Y-%m-%dT%H:%M:%S %Z';
638
  my $datetime_format = '%a, %Y-%m-%dT%H:%M:%S %Z';
635
  printf __"Earliest article: %s\n",
639
  printf __"Earliest article:            %s" . "\n",
636
    $earliest_datetime->strftime($datetime_format);
640
    $earliest_datetime->strftime($datetime_format);
637
  printf __"Latest article:   %s\n",
641
  printf __"Latest article:              %s" . "\n",
638
    $latest_datetime->strftime($datetime_format);
642
    $latest_datetime->strftime($datetime_format);
639
  printf __"Original articles: %s; replies: %s\n",
643
  printf __"Original articles:           %s; replies: %s" . "\n",
640
    $formatter->format_number($origposts),
644
    $formatter->format_number($origposts),
641
    $formatter->format_number($replies);
645
    $formatter->format_number($replies);
642
  printf __"Total size of articles: %s bytes (%s)" . "\n",
646
  printf __"Total size of articles:      %s bytes (%s)" . "\n",
643
    $formatter->format_number($totsize),
647
    $formatter->format_number($totsize),
644
    $formatter->format_bytes( $totsize, ( 'precision' => 1, 'mode' => 'iec' ) );
648
    $formatter->format_bytes( $totsize, ( 'precision' => 1, 'mode' => 'iec' ) );
645
  printf __"Average %s articles per day, %s per day, %s bytes per article\n",
649
  printf __"Average %s articles per day, %s per day, %s bytes per article.\n",
646
    $formatter->format_number( int( $totalposts / $numdays ) ),
650
    $formatter->format_number( int( $totalposts / $numdays ) ),
647
    $formatter->format_bytes( $totsize / $numdays, ( 'mode' => 'iec' ) ),
651
    $formatter->format_bytes( $totsize / $numdays, ( 'mode' => 'iec' ) ),
648
    $formatter->format_number( int( $totsize / $totalposts ) );
652
    $formatter->format_number( int( $totsize / $totalposts ) );
649
653
650
  my $count = keys %data;
654
  my $count = keys %data;
-
 
655
  print "\n";
651
  printf __"Total headers: %s; bodies: %s\n",
656
  printf __"Total headers:      %s; bodies: %s\n",
652
    $formatter->format_bytes(
657
    $formatter->format_bytes(
653
    $totheader, ( 'precision' => 1, 'mode' => 'iec' )
658
    $totheader, ( 'precision' => 1, 'mode' => 'iec' )
654
    ),
659
    ),
655
    $formatter->format_bytes( $totbody, ( 'precision' => 1, 'mode' => 'iec' ) );
660
    $formatter->format_bytes( $totbody, ( 'precision' => 1, 'mode' => 'iec' ) );
656
  printf __
661
  printf __
657
    "Body text - quoted: %s; original: %s = %s%%; sigs: %s\n",
662
    "Body text - quoted: %s; original: %s = %s%%; sigs: %s\n",
658
    $formatter->format_bytes(
663
    $formatter->format_bytes(
659
    $totquoted, ( 'precision' => 1, 'mode' => 'iec' )
664
    $totquoted, ( 'precision' => 1, 'mode' => 'iec' )
660
    ),
665
    ),
661
    $formatter->format_bytes( $totorig, ( 'precision' => 1, 'mode' => 'iec' ) ),
666
    $formatter->format_bytes( $totorig, ( 'precision' => 1, 'mode' => 'iec' ) ),
662
    $formatter->format_number( ( $totorig * 100 ) / ( $totorig + $totquoted ) ),
667
    $formatter->format_number( ( $totorig * 100 ) / ( $totorig + $totquoted ) )
-
 
668
    ,
663
    $formatter->format_bytes( $totsig, ( 'precision' => 1, 'mode' => 'iec' ) );
669
    $formatter->format_bytes( $totsig, ( 'precision' => 1, 'mode' => 'iec' ) );
-
 
670
  print "\n";
664
  printf __"Total number of posters: %s, average %s per poster\n",
671
  printf __"Total number of posters:     %s, average %s per poster\n",
665
    $formatter->format_number($count),
672
    $formatter->format_number($count),
666
    $formatter->format_bytes( $totsize / $count,
673
    $formatter->format_bytes( $totsize / $count,
667
    ( 'precision' => 1, 'mode' => 'iec' ) );
674
    ( 'precision' => 1, 'mode' => 'iec' ) );
668
  $count = keys %threads;
675
  $count = keys %threads;
669
  printf __"Total number of threads: %s, average %s per thread\n",
676
  printf __"Total number of threads:     %s, average %s per thread\n",
670
    $formatter->format_number($count),
677
    $formatter->format_number($count),
671
    $formatter->format_bytes( $totsize / $count,
678
    $formatter->format_bytes( $totsize / $count,
672
    ( 'precision' => 1, 'mode' => 'iec' ) );
679
    ( 'precision' => 1, 'mode' => 'iec' ) );
673
  printf __"Total number of user agents: %d\n",
680
  printf __"Total number of user agents: %d\n",
674
    $formatter->format_number( scalar keys %agents );
681
    $formatter->format_number( scalar keys %agents );