public function init() { DebugBar::withDebugBar(function (DebugBar\DebugBar $debugbar) { /* @var $timeData DebugBar\DataCollector\TimeDataCollector */ $timeData = $debugbar['time']; if (!$timeData) { return; } if ($timeData->hasStartedMeasure("cms_accessed")) { $timeData->stopMeasure("cms_accessed"); } $timeData->startMeasure("cms_init", "cms init"); }); }
/** * Filter executed before a request processes * * @param SS_HTTPRequest $request Request container object * @param Session $session Request session * @param DataModel $model Current DataModel * @return boolean Whether to continue processing other filters. Null or true will continue processing (optional) */ public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model) { DebugBar::withDebugBar(function (DebugBar\DebugBar $debugbar) { /* @var $timeData DebugBar\DataCollector\TimeDataCollector */ $timeData = $debugbar['time']; if (!$timeData) { return; } if (isset($_SERVER['REQUEST_TIME_FLOAT'])) { $timeData = $debugbar['time']; $timeData->addMeasure("framework boot", $_SERVER['REQUEST_TIME_FLOAT'], microtime(true)); } $timeData->startMeasure("pre_request", "pre request"); }); }
/** * Due to a bug, this is not always called before 4.0, * see https://github.com/silverstripe/silverstripe-framework/pull/5173 * * @param SS_HTTPRequest $request * @param string $action * @param mixed $result (only in v4.0) */ public function afterCallActionHandler($request, $action, $result) { self::clearBuffer(); $class = get_class($this->owner); DebugBar::withDebugBar(function (DebugBar\DebugBar $debugbar) use($class, $action) { /* @var $timeData DebugBar\DataCollector\TimeDataCollector */ $timeData = $debugbar['time']; if (!$timeData) { return; } if ($timeData->hasStartedMeasure("action")) { $timeData->stopMeasure("action"); } $timeData->startMeasure("after_action", "{$class} after action {$action}"); }); }