<?php
/**
- * @section LICENSE
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* @file
*/
+use RunningStat\RunningStat;
+
/**
* Convenience class for working with XHProf
* <https://github.com/phacility/xhprof>. XHProf can be installed as a PECL
}
for ( $i = 0; $i < $stats['ct']; $i++ ) {
- $this->inclusive[$child][$stat]->push(
+ $this->inclusive[$child][$stat]->addObservation(
$value / $stats['ct']
);
}
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,
);
}
}
$this->complete[$func]['subcalls'] = array();
}
- foreach( $this->hieraData as $key => $stats ) {
+ foreach ( $this->hieraData as $key => $stats ) {
list( $parent, $child ) = self::splitKey( $key );
if ( $parent !== null ) {
// Track call tree information