private function BenchmarkCommand::generateYaml in Devel 8
Same name and namespace in other branches
- 8.3 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::generateYaml()
- 8.2 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::generateYaml()
- 4.x webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::generateYaml()
Parameters
$gitHash:
$runs:
$url:
\Drupal\webprofiler\Command\BenchmarkData $avg:
\Drupal\webprofiler\Command\BenchmarkData $median:
\Drupal\webprofiler\Command\BenchmarkData $percentile95:
Return value
string
1 call to BenchmarkCommand::generateYaml()
- BenchmarkCommand::execute in webprofiler/
src/ Command/ BenchmarkCommand.php - Executes the current command.
File
- webprofiler/
src/ Command/ BenchmarkCommand.php, line 281
Class
- BenchmarkCommand
- Class BenchmarkCommand
Namespace
Drupal\webprofiler\CommandCode
private function generateYaml($gitHash, $runs, $url, BenchmarkData $avg, BenchmarkData $median, BenchmarkData $percentile95) {
$yaml = Yaml::dump([
'date' => date($this
->trans('commands.webprofiler.list.rows.time'), time()),
'git_commit' => $gitHash,
'number_of_runs' => $runs,
'url' => $url,
'results' => [
'average' => [
'time' => sprintf('%.0f ms', $avg
->getTime()),
'memory' => sprintf('%.1f MB', $avg
->getMemory() / 1024 / 1024),
],
'median' => [
'time' => sprintf('%.0f ms', $median
->getTime()),
'memory' => sprintf('%.1f MB', $median
->getMemory() / 1024 / 1024),
],
'95_percentile' => [
'time' => sprintf('%.0f ms', $percentile95
->getTime()),
'memory' => sprintf('%.1f MB', $percentile95
->getMemory() / 1024 / 1024),
],
],
]);
return $yaml;
}