X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Flibs%2FXhprofData.php;h=90e52f08ddc6611e4377be47c39aac1c2c467670;hb=115ebbe89d25522b5a967b87977fc7ecf3188a95;hp=0be4ff6ad851ff67f5b6e7614c46204161256d2b;hpb=949dc920ee61e838320186565cb6dc146a013b25;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/XhprofData.php b/includes/libs/XhprofData.php index 0be4ff6ad8..90e52f08dd 100644 --- a/includes/libs/XhprofData.php +++ b/includes/libs/XhprofData.php @@ -18,7 +18,7 @@ * @file */ -use RunningStat\RunningStat; +use Wikimedia\RunningStat; /** * Convenience class for working with XHProf profiling data @@ -209,14 +209,14 @@ class XhprofData { foreach ( $this->inclusive as $func => $stats ) { foreach ( $stats as $name => $value ) { if ( $value instanceof RunningStat ) { - $total = $value->m1 * $value->n; + $total = $value->getMean() * $value->getCount(); $percent = ( isset( $main[$name] ) && $main[$name] ) ? 100 * $total / $main[$name] : 0; $this->inclusive[$func][$name] = [ 'total' => $total, 'min' => $value->min, - 'mean' => $value->m1, + 'mean' => $value->getMean(), 'max' => $value->max, 'variance' => $value->m2, 'percent' => $percent, @@ -370,11 +370,10 @@ class XhprofData { return function ( $a, $b ) use ( $key, $sub ) { if ( isset( $a[$key] ) && isset( $b[$key] ) ) { // Descending sort: larger values will be first in result. - // Assumes all values are numeric. // Values for 'main()' will not have sub keys $valA = is_array( $a[$key] ) ? $a[$key][$sub] : $a[$key]; $valB = is_array( $b[$key] ) ? $b[$key][$sub] : $b[$key]; - return $valB - $valA; + return $valB <=> $valA; } else { // Sort datum with the key before those without return isset( $a[$key] ) ? -1 : 1;