jenkins-bot has submitted this change and it was merged.

Change subject: xhprof: Guard against division by 0 when computing percentages
......................................................................


xhprof: Guard against division by 0 when computing percentages

Change-Id: Icce3b5be1136c541dc87c44b01a42709f19ca885
---
M includes/libs/Xhprof.php
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/libs/Xhprof.php b/includes/libs/Xhprof.php
index 990e2c3..98ff675 100644
--- a/includes/libs/Xhprof.php
+++ b/includes/libs/Xhprof.php
@@ -267,13 +267,16 @@
                                foreach ( $stats as $name => $value ) {
                                        if ( $value instanceof RunningStat ) {
                                                $total = $value->m1 * $value->n;
+                                               $percent = ( isset( 
$main[$name] ) && $main[$name] )
+                                                       ? 100 * $total / 
$main[$name]
+                                                       : 0;
                                                $this->inclusive[$func][$name] 
= array(
                                                        'total' => $total,
                                                        'min' => $value->min,
                                                        'mean' => $value->m1,
                                                        'max' => $value->max,
                                                        'variance' => 
$value->m2,
-                                                       'percent' => 100 * 
$total / $main[$name],
+                                                       'percent' => $percent,
                                                );
                                        }
                                }

-- 
To view, visit https://gerrit.wikimedia.org/r/177464
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icce3b5be1136c541dc87c44b01a42709f19ca885
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to