When you want to calculate average time, do not divide count by time :)
Test plan:
Run the script with a where condition and verbose option and see that
the average time is meaningful.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
my $time = $endtime-$startime;
my $accuracy = ($goodcount / $totalcount) * 100; # this is a percentage
my $averagetime = 0;
-unless ($time == 0) { $averagetime = $totalcount / $time; };
+$averagetime = $time / $totalcount if $totalcount;
print "Good: $goodcount, Bad: $badcount (of $totalcount) in $time seconds\n";
printf "Accuracy: %.2f%%\nAverage time per record: %.6f seconds\n", $accuracy, $averagetime if (defined $verbose);
my $time = $endtime-$startime;
my $accuracy = ($goodcount / $totalcount) * 100; # this is a percentage
my $averagetime = 0;
-unless ($time == 0) {$averagetime = $totalcount / $time;};
+$averagetime = $time / $totalcount if $totalcount;
print "Good: $goodcount, Bad: $badcount (of $totalcount) in $time seconds\n";
printf "Accuracy: %.2f%%\nAverage time per record: %.6f seconds\n", $accuracy, $averagetime if (defined $verbose);