From b3b86caaa5473ea51dc7223146e4c7cf0db431dc Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 28 Aug 2017 11:59:19 +0200 Subject: [PATCH] Bug 19190: Silly calculation of average time in touch_all scripts 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 Signed-off-by: David Bourgault Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- misc/maintenance/touch_all_biblios.pl | 2 +- misc/maintenance/touch_all_items.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/maintenance/touch_all_biblios.pl b/misc/maintenance/touch_all_biblios.pl index d0910899ba..b6a5addf38 100755 --- a/misc/maintenance/touch_all_biblios.pl +++ b/misc/maintenance/touch_all_biblios.pl @@ -99,7 +99,7 @@ my $endtime = time(); 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); diff --git a/misc/maintenance/touch_all_items.pl b/misc/maintenance/touch_all_items.pl index fdbce5c936..64c70e37e6 100755 --- a/misc/maintenance/touch_all_items.pl +++ b/misc/maintenance/touch_all_items.pl @@ -98,7 +98,7 @@ my $endtime = time(); 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); -- 2.39.5