use strict; use warnings; use Time::HiRes qw(gettimeofday tv_interval); # Determine the module load time my $t = [ gettimeofday() ]; require Mail::SpamAssassin; import Mail::SpamAssassin (); printf("%.6f", tv_interval($t, [ gettimeofday() ])); # Determine object creation time $t = [ gettimeofday() ]; my $sa = Mail::SpamAssassin->new({local_tests_only => 1, dont_copy_prefs => 1}); printf(",%.6f", tv_interval($t, [ gettimeofday() ])); # Determine rule compile time $t = [ gettimeofday() ]; $sa->compile_now(0, 0); printf(",%.6f", tv_interval($t, [ gettimeofday() ])); # Scan all the files given on the command line, determine scan time $t = [ gettimeofday() ]; foreach my $msg (@ARGV) { open(my $fh, '<', $msg) or die "open($msg): $!\n"; my $mail = $sa->parse($fh); close($fh); my $status = $sa->check($mail); $status->finish(); $mail->finish(); } printf(",%.6f\n", tv_interval($t, [ gettimeofday() ]));