You are here

public static function XHProfAggregator::sd in XHProf 6

Same name and namespace in other branches
  1. 7 XHProfLib/XHProfAggregator.php \XHProfAggregator::sd()

Function to calculate standard deviation (uses sd_square)

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

File

XHProfLib/XHProfAggregator.php, line 99

Class

XHProfAggregator

Code

public static function sd($array) {

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