private function BenchmarkCommand::computeAvg in Devel 8
Same name and namespace in other branches
- 8.3 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::computeAvg()
- 8.2 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::computeAvg()
- 4.x webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::computeAvg()
Parameters
\Drupal\webprofiler\Command\BenchmarkData[] $datas:
Return value
\Drupal\webprofiler\Command\BenchmarkData
1 call to BenchmarkCommand::computeAvg()
- BenchmarkCommand::execute in webprofiler/
src/ Command/ BenchmarkCommand.php - Executes the current command.
File
- webprofiler/
src/ Command/ BenchmarkCommand.php, line 183
Class
- BenchmarkCommand
- Class BenchmarkCommand
Namespace
Drupal\webprofiler\CommandCode
private function computeAvg($datas) {
$profiles = count($datas);
$totalTime = 0;
$totalMemory = 0;
foreach ($datas as $data) {
$totalTime += $data
->getTime();
$totalMemory += $data
->getMemory();
}
return new BenchmarkData(NULL, $totalMemory / $profiles, $totalTime / $profiles);
}