dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
dd1bf48
)
Merge "xhprof: Guard against division by 0 when computing percentages"
author
jenkins-bot
<jenkins-bot@gerrit.wikimedia.org>
Sun, 7 Dec 2014 20:58:45 +0000
(20:58 +0000)
committer
Gerrit Code Review
<gerrit@wikimedia.org>
Sun, 7 Dec 2014 20:58:45 +0000
(20:58 +0000)
includes/libs/Xhprof.php
patch
|
blob
|
history
diff --git
a/includes/libs/Xhprof.php
b/includes/libs/Xhprof.php
index
990e2c3
..
98ff675
100644
(file)
--- a/
includes/libs/Xhprof.php
+++ b/
includes/libs/Xhprof.php
@@
-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
,
);
}
}