コード例 #1
0
ファイル: MemoryPeakAgent.php プロジェクト: renanbr/telltale
 /**
  * {@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;
 }
コード例 #2
0
 /**
  * {@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;
 }