benchmarks: Fix divide by zero in Benchmarker
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 1 Feb 2018 21:26:09 +0000 (16:26 -0500)
committerKrinkle <krinklemail@gmail.com>
Fri, 2 Feb 2018 02:24:49 +0000 (02:24 +0000)
Follows-up 593442683dc471c0.

Bug: T186269
Change-Id: I011a8614e0acf489daf5bd9dcb932e920b995092

maintenance/benchmarks/Benchmarker.php

index f1e7dbb..e1eef07 100644 (file)
@@ -100,7 +100,7 @@ abstract class Benchmarker extends Maintenance {
                                'name' => $name,
                                'count' => $stat->getCount(),
                                // Get rate per second from mean (in ms)
-                               'rate' => 1.0 / ( $stat->getMean() / 1000.0 ),
+                               'rate' => $stat->getMean() == 0 ? INF : ( 1.0 / ( $stat->getMean() / 1000.0 ) ),
                                'total' => $stat->getMean() * $stat->getCount(),
                                'mean' => $stat->getMean(),
                                'max' => $stat->max,