You are here

private function XHProfController::getSummaryRows in XHProf 8

Parameters

\Drupal\xhprof\XHProfLib\Report\ReportInterface $report:

array $descriptions:

Return value

array

1 call to XHProfController::getSummaryRows()
XHProfController::runAction in src/Controller/XHProfController.php
Renders the run.

File

src/Controller/XHProfController.php, line 381

Class

XHProfController
Displays profiling results.

Namespace

Drupal\xhprof\Controller

Code

private function getSummaryRows(ReportInterface $report, $descriptions) {
  $summaryRows = [];
  $possibileMetrics = $report
    ->getPossibleMetrics();
  foreach ($report
    ->getSummary() as $metric => $value) {
    $key = 'Total ' . Xss::filter($descriptions[$metric], []);
    $unit = isset($possibileMetrics[$metric]) ? $possibileMetrics[$metric][1] : '';
    $value = new FormattableMarkup('@value @unit', [
      '@value' => $value,
      '@unit' => $unit,
    ]);
    $summaryRows[] = [
      $key,
      $value,
    ];
  }
  return $summaryRows;
}