protected function _compile_benchmarks()
{
$profile = array();
$output = array();
foreach ($this->CI->benchmark->marker as $key => $val) {
// We match the "end" marker so that the list ends
// up in the order that it was defined
if (preg_match("/(.+?)_end/i", $key, $match)) {
if (isset($this->CI->benchmark->marker[$match[1] . '_end']) and isset($this->CI->benchmark->marker[$match[1] . '_start'])) {
$profile[$match[1]] = $this->CI->benchmark->elapsed_time($match[1] . '_start', $key);
}
}
}
// Build a table containing the profile data.
// Note: At some point we might want to make this data available to be logged.
foreach ($profile as $key => $val) {
$key = ucwords(str_replace(array('_', '-'), ' ', $key));
$output[$key] = $val;
}
unset($profile);
return $output;
}