calculateSelf() публичный Метод

We get a==>b as the name, we need a key for a and b in the array to get exclusive values for A we need to subtract the values of B (and any other children); call passing in the entire profile only, should return an array of functions with their regular timing, and exclusive numbers inside ['exclusive'] Consider: ---c---d---e a -/----b---d---e We have c==>d and b==>d, and in both instances d invokes e, yet we will have but a single d==>e result. This is a known and documented limitation of XHProf We have one d==>e entry, with some values, including ct=2 We also have c==>d and b==>d We should determine how many ==>d options there are, and equally split the cost of d==>e across them since d==>e represents the sum total of all calls. Notes: Function names are not unique, but we're merging them
public calculateSelf ( ) : Xhgui_Profile
Результат Xhgui_Profile A new instance with exclusive data set.
Пример #1
0
 public function testCalculateSelf()
 {
     $profile = new Xhgui_Profile($this->_fixture[1]);
     $result = $profile->calculateSelf()->getProfile();
     $main = $result['main()'];
     $this->assertEquals(800, $main['emu']);
     $this->assertEquals(250, $main['epmu']);
     $this->assertEquals(array(null), $main['parents']);
     $func = $result['eat_burger()'];
     $this->assertEquals(2, $func['ewt']);
     $this->assertEquals(1850, $func['emu']);
     $this->assertEquals(2300, $func['epmu']);
     $this->assertEquals(array('main()'), $func['parents']);
 }
Пример #2
0
 /**
  * Compare this run to another run.
  *
  * @param Xhgui_Profile $head The other run to compare with
  * @return array An array of comparison data.
  */
 public function compare(Xhgui_Profile $head)
 {
     $this->calculateSelf();
     $head->calculateSelf();
     $keys = array_merge($this->_keys, $this->_exclusiveKeys);
     $emptyData = array_fill_keys($keys, 0);
     $diffPercent = array();
     $diff = array();
     foreach ($this->_collapsed as $key => $baseData) {
         $headData = $head->get($key);
         if (!$headData) {
             $diff[$key] = $this->_diffKeys($emptyData, $baseData);
             continue;
         }
         $diff[$key] = $this->_diffKeys($headData, $baseData);
         if ($key === 'main()') {
             $diffPercent[$key] = $this->_diffPercentKeys($headData, $baseData);
         }
     }
     $diff['functionCount'] = $head->getFunctionCount() - $this->getFunctionCount();
     $diffPercent['functionCount'] = $head->getFunctionCount() / $this->getFunctionCount();
     return array('base' => $this, 'head' => $head, 'diff' => $diff, 'diffPercent' => $diffPercent);
 }