private function XHProfDataCollector::getMetric in XHProf 8
Parameters
int $runId:
Return value
array
2 calls to XHProfDataCollector::getMetric()
- XHProfDataCollector::getCalls in src/
DataCollector/ XHProfDataCollector.php - XHProfDataCollector::getWt in src/
DataCollector/ XHProfDataCollector.php
File
- src/
DataCollector/ XHProfDataCollector.php, line 104
Class
- XHProfDataCollector
- Class XHProfDataCollector.
Namespace
Drupal\xhprof\DataCollectorCode
private function getMetric($runId, $metric) {
if (!isset($this->summary)) {
/** @var \Drupal\xhprof\ProfilerInterface $profiler */
$profiler = \Drupal::service('xhprof.profiler');
/** @var \Drupal\xhprof\XHProfLib\Run $run */
$run = $profiler
->getRun($runId);
/** @var \Drupal\xhprof\XHProfLib\Report\ReportEngine $reportEngine */
$reportEngine = \Drupal::service('xhprof.report_engine');
$report = $reportEngine
->getReport(NULL, NULL, $run, NULL, NULL);
$this->summary = $report
->getSummary();
$this->possibileMetrics = $report
->getPossibleMetrics();
}
$unit = isset($this->possibileMetrics[$metric]) ? $this->possibileMetrics[$metric][1] : '';
return new FormattableMarkup('@value @unit', [
'@value' => $this->summary[$metric],
'@unit' => $unit,
]);
}