Beispiel #1
0
 /**
  * Wire signals to slots as needed.
  *
  * @param \TYPO3\Flow\SignalSlot\Dispatcher $dispatcher
  * @param Profiler $profiler
  * @param \Sandstorm\PhpProfiler\Domain\Model\ProfilingRun $run
  * @param \TYPO3\Flow\Core\Bootstrap $bootstrap
  * @return void
  */
 protected function connectToSignals(\TYPO3\Flow\SignalSlot\Dispatcher $dispatcher, Profiler $profiler, \Sandstorm\PhpProfiler\Domain\Model\ProfilingRun $run, \TYPO3\Flow\Core\Bootstrap $bootstrap)
 {
     $dispatcher->connect('TYPO3\\Flow\\Core\\Booting\\Sequence', 'beforeInvokeStep', function ($step) use($run) {
         $run->startTimer('Boostrap Sequence: ' . $step->getIdentifier());
     });
     $dispatcher->connect('TYPO3\\Flow\\Core\\Booting\\Sequence', 'afterInvokeStep', function ($step) use($run) {
         $run->stopTimer('Boostrap Sequence: ' . $step->getIdentifier());
     });
     $dispatcher->connect('TYPO3\\Flow\\Core\\Bootstrap', 'finishedRuntimeRun', function () use($profiler, $bootstrap) {
         $run = $profiler->stop();
         if ($run) {
             $profiler->save($run);
         }
     });
     $dispatcher->connect('TYPO3\\Flow\\Core\\Bootstrap', 'finishedCompiletimeRun', function () use($profiler, $bootstrap) {
         $run = $profiler->stop();
         if ($run) {
             $run->setOption('Context', 'COMPILE');
             $profiler->save($run);
         }
     });
     $dispatcher->connect('TYPO3\\Flow\\Mvc\\Dispatcher', 'beforeControllerInvocation', function ($request, $response, $controller) use($run) {
         $run->setOption('Controller Name', get_class($controller));
         $data = array('Controller' => get_class($controller));
         if ($request instanceof \TYPO3\Flow\Mvc\ActionRequest) {
             $data['Action'] = $request->getControllerActionName();
         }
         $run->startTimer('MVC: Controller Invocation', $data);
     });
     $dispatcher->connect('TYPO3\\Flow\\Mvc\\Dispatcher', 'afterControllerInvocation', function () use($run) {
         $run->stopTimer('MVC: Controller Invocation');
     });
 }
 /**
  * Around advice
  *
  * @Flow\Around("method(TYPO3\TypoScript\TypoScriptObjects\TemplateImplementation->evaluate())")
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
  * @return array Result of the target method
  */
 public function profileTemplateImplementationEvaluate(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
 {
     \Sandstorm\PhpProfiler\Profiler::getInstance()->getRun()->startTimer('TYPO3.Neos: TypoScript Template Rendering');
     $output = $joinPoint->getAdviceChain()->proceed($joinPoint);
     \Sandstorm\PhpProfiler\Profiler::getInstance()->getRun()->stopTimer('TYPO3.Neos: TypoScript Template Rendering');
     return $output;
 }
 /**
  * Around advice
  *
  * @Flow\Around("method(TYPO3\Flow\Mvc\Routing\Router->route())")
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
  * @return array Result of the target method
  */
 public function profileRouteMethod(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
 {
     \Sandstorm\PhpProfiler\Profiler::getInstance()->getRun()->startTimer('MVC: Build Request / Routing');
     $output = $joinPoint->getAdviceChain()->proceed($joinPoint);
     \Sandstorm\PhpProfiler\Profiler::getInstance()->getRun()->stopTimer('MVC: Build Request / Routing');
     return $output;
 }
 /**
  * Around advice
  *
  * @Flow\Around("method(TYPO3\TYPO3CR\TypeConverter\NodeConverter->convertFrom())")
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
  * @return array Result of the target method
  */
 public function profileConvertFromMethod(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
 {
     \Sandstorm\PhpProfiler\Profiler::getInstance()->getRun()->startTimer('Property Mapping: Node Converter');
     $output = $joinPoint->getAdviceChain()->proceed($joinPoint);
     \Sandstorm\PhpProfiler\Profiler::getInstance()->getRun()->stopTimer('Property Mapping: Node Converter');
     return $output;
 }
 /**
  *
  * @Flow\Around("methodAnnotatedWith(Sandstorm\PhpProfiler\Annotations\Profile)")
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
  * @return array Result of the target method
  */
 public function profileAround(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
 {
     $run = \Sandstorm\PhpProfiler\Profiler::getInstance()->getRun();
     $tag = str_replace('\\', '_', $joinPoint->getClassName()) . ':' . $joinPoint->getMethodName();
     $run->startTimer($tag);
     $result = $joinPoint->getAdviceChain()->proceed($joinPoint);
     $run->stopTimer($tag);
     return $result;
 }
 /**
  * Initializes the controller before invoking an action method.
  *
  * @return void
  */
 protected function initializeAction()
 {
     \Sandstorm\PhpProfiler\Profiler::getInstance()->stop();
 }