function 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

File

webprofiler/src/Command/BenchmarkCommand.php, line 183

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