Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function analyse()
 {
     parent::analyse();
     list($peak, $call, $file, $line) = $this->parse();
     $memory = Format::bytes($peak);
     $details = null;
     if ($call) {
         $details = ' at ' . $call . '() in ' . $file . ' on line ' . $line;
     }
     $report = $this->createReport();
     $report->setText('Memory peak ' . $memory . $details);
     return $report;
 }
 /**
  * {@inheritdoc}
  */
 public function analyse()
 {
     parent::analyse();
     // calculate critical path
     $this->parse();
     $critical = array();
     $this->extract($this->tree, $critical);
     $report = $this->createReport();
     $root = reset($critical);
     $time = Format::time($root['time']);
     $report->setTitle("Critical path ({$time})");
     $report->addRow(array('', 'Call', 'Time', 'Memory', 'File', 'Line', ''));
     foreach ($critical as $position => $call) {
         $name = str_repeat('.', $position) . ' ' . $call['name'] . '()';
         $type = $call['is-internal'] ? 'internal' : 'user defined';
         $report->addRow(array((string) $position, trim($name), Format::time($call['time']), Format::bytes($call['memory']), $call['file'], $call['line'], $type));
     }
     return $report;
 }
 /**
  * {@inheritdoc}
  */
 public function analyse()
 {
     parent::analyse();
     $this->parse();
     $calls = array_slice($this->getSortedCalls('time-own'), 0, 5);
     $report = $this->createReport();
     $report->setTitle('Slowest calls');
     $report->addRow(array('', 'Call', '# of Calls', 'Own Time', 'Including Children', ''));
     $position = 0;
     foreach ($calls as $name => $call) {
         if ($call['is-internal']) {
             $type = 'internal';
             $inclusive = '-';
         } else {
             $type = 'user defined';
             $inclusive = Format::time($call['time-inclusive']);
         }
         $report->addRow(array((string) $position++, $name . '()', (string) $call['times'], Format::time($call['time-own']), $inclusive, $type));
     }
     return $report;
 }
Exemple #4
0
 /**
  * @dataProvider providerTime
  * @covers Telltale\Util\Format::time
  */
 public function testTime($seconds, $expected)
 {
     $this->assertEquals($expected, Format::time($seconds));
 }