public function run(float
$startTime, float
$totalTime, RequestInterface
$request, ResponseInterface
$response): string
{ $data =
[];
// Data items used within the view.
$data['url'
] =
current_url();
$data['method'
] =
strtoupper($request->
getMethod());
$data['isAJAX'
] =
$request->
isAJAX();
$data['startTime'
] =
$startTime;
$data['totalTime'
] =
$totalTime * 1000;
$data['totalMemory'
] =
number_format((memory_get_peak_usage()) / 1024 / 1024, 3
);
$data['segmentDuration'
] =
$this->
roundTo($data['totalTime'
] / 7
);
$data['segmentCount'
] =
(int) ceil($data['totalTime'
] /
$data['segmentDuration'
]);
$data['CI_VERSION'
] = CodeIgniter::CI_VERSION;
$data['collectors'
] =
[];
foreach ($this->collectors
as $collector) { $data['collectors'
][] =
$collector->
getAsArray();
} foreach ($this->
collectVarData() as $heading =>
$items) { $varData =
[];