/** * 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; }
/** * Sets up xhprof, some directories, the profiler and wires signals to slots. * * @param Bootstrap $bootstrap * @return void */ public function boot(Bootstrap $bootstrap) { if (($samplingRate = getenv('PHPPROFILER_SAMPLINGRATE')) !== FALSE) { $currentSampleValue = mt_rand() / mt_getrandmax(); if ($currentSampleValue > (double) $samplingRate) { return; } } $profiler = Profiler::getInstance(); $profiler->setConfigurationProvider(function () use($bootstrap) { $settings = $bootstrap->getEarlyInstance('TYPO3\\Flow\\Configuration\\ConfigurationManager')->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Sandstorm.PhpProfiler'); if (!file_exists($settings['plumber']['profilePath'])) { Files::createDirectoryRecursively($settings['plumber']['profilePath']); } return $settings; }); $run = $profiler->start(); $run->setOption('Context', (string) $bootstrap->getContext()); $dispatcher = $bootstrap->getSignalSlotDispatcher(); $this->connectToSignals($dispatcher, $profiler, $run, $bootstrap); $this->connectToNeosSignals($dispatcher, $profiler, $run, $bootstrap); }
/** * Initializes the controller before invoking an action method. * * @return void */ protected function initializeAction() { \Sandstorm\PhpProfiler\Profiler::getInstance()->stop(); }