You are here

public static function Aggregator::sd in XHProf 8

Function to calculate standard deviation (uses sd_square)

1 call to Aggregator::sd()
Aggregator::average in src/XHProfLib/Aggregator.php

File

src/XHProfLib/Aggregator.php, line 125

Class

Aggregator

Namespace

Drupal\xhprof\XHProfLib

Code

public static function sd($array) {

  // square root of sum of squares devided by N-1
  return sqrt(array_sum(array_map([
    'XHProfTools',
    'sd_square',
  ], $array, array_fill(0, count($array), array_sum($array) / count($array)))) / (count($array) - 1));
}