profiler: Document SectionProfiler private start and end as 'array|null'
Follows-up I2d35bfddfcc4c194aa7. Also add a second check for is_array on end to please static analysis. Change-Id: Ie8cf4bb1a6e64479cc411f049d7aab08570e6aa1
This commit is contained in:
parent
f05872cfd6
commit
c243872abb
1 changed files with 3 additions and 3 deletions
|
|
@ -28,9 +28,9 @@ use Wikimedia\ScopedCallback;
|
||||||
* @ingroup Profiler
|
* @ingroup Profiler
|
||||||
*/
|
*/
|
||||||
class SectionProfiler {
|
class SectionProfiler {
|
||||||
/** @var array Map of (mem,real,cpu) */
|
/** @var array|null Map of (mem,real,cpu) */
|
||||||
protected $start;
|
protected $start;
|
||||||
/** @var array Map of (mem,real,cpu) */
|
/** @var array|null Map of (mem,real,cpu) */
|
||||||
protected $end;
|
protected $end;
|
||||||
/** @var array[] List of resolved profile calls with start/end data */
|
/** @var array[] List of resolved profile calls with start/end data */
|
||||||
protected $stack = [];
|
protected $stack = [];
|
||||||
|
|
@ -96,7 +96,7 @@ class SectionProfiler {
|
||||||
public function getFunctionStats() {
|
public function getFunctionStats() {
|
||||||
$this->collateData();
|
$this->collateData();
|
||||||
|
|
||||||
if ( is_array( $this->start ) ) {
|
if ( is_array( $this->start ) && is_array( $this->end ) ) {
|
||||||
$totalCpu = max( $this->end['cpu'] - $this->start['cpu'], 0 );
|
$totalCpu = max( $this->end['cpu'] - $this->start['cpu'], 0 );
|
||||||
$totalReal = max( $this->end['real'] - $this->start['real'], 0 );
|
$totalReal = max( $this->end['real'] - $this->start['real'], 0 );
|
||||||
$totalMem = max( $this->end['memory'] - $this->start['memory'], 0 );
|
$totalMem = max( $this->end['memory'] - $this->start['memory'], 0 );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue