Merge "Parser test for "Free external link with trailing punctuation""
[lhc/web/wiklou.git] / includes / libs / Xhprof.php
index 990e2c3..98ff675 100644 (file)
@@ -267,13 +267,16 @@ class Xhprof {
                                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,
                                                );
                                        }
                                }