You are here

private function BenchmarkCommand::computeAvg in Devel 8.3

Same name and namespace in other branches
  1. 8 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::computeAvg()
  2. 8.2 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::computeAvg()
  3. 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 182

Class

BenchmarkCommand
Class BenchmarkCommand.

Namespace

Drupal\webprofiler\Command

Code

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);
}