Skip to content

Instantly share code, notes, and snippets.

@lisachenko
Last active December 18, 2015 03:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lisachenko/5716537 to your computer and use it in GitHub Desktop.
Save lisachenko/5716537 to your computer and use it in GitHub Desktop.
Zend framework getters
Zend\Mvc\Application:getRequest is called 1 times and took 0.047 ms
Zend\Mvc\ResponseSender\SendResponseEvent:setTarget is called 1 times and took 0.047 ms
Zend\ModuleManager\Listener\ListenerOptions:getConfigGlobPaths is called 1 times and took 0.048 ms
Zend\ModuleManager\ModuleEvent:getConfigListener is called 1 times and took 0.048 ms
Zend\Mvc\ResponseSender\SendResponseEvent:getName is called 1 times and took 0.048 ms
Zend\ModuleManager\ModuleManager:getModules is called 1 times and took 0.049 ms
Zend\ModuleManager\Listener\ListenerOptions:getConfigStaticPaths is called 1 times and took 0.049 ms
Zend\ModuleManager\ModuleEvent:getParams is called 1 times and took 0.052 ms
Zend\Mvc\Router\Http\RouteMatch:getLength is called 1 times and took 0.053 ms
Zend\I18n\Translator\Translator:getCache is called 1 times and took 0.054 ms
Zend\Http\PhpEnvironment\Response:getContent is called 1 times and took 0.054 ms
Zend\ModuleManager\Listener\ListenerOptions:getExtraConfig is called 1 times and took 0.055 ms
Application\Controller\IndexController:getEvent is called 1 times and took 0.058 ms
Zend\Mvc\Controller\ControllerManager:getServiceLocator is called 1 times and took 0.058 ms
Zend\View\Helper\HeadLink:getRegistry is called 1 times and took 0.060 ms
Zend\Http\PhpEnvironment\Response:getVersion is called 1 times and took 0.061 ms
Zend\Http\PhpEnvironment\Response:getReasonPhrase is called 1 times and took 0.063 ms
Zend\Http\PhpEnvironment\Response:getHeaders is called 1 times and took 0.063 ms
Zend\View\Helper\HeadTitle:getRegistry is called 1 times and took 0.063 ms
Zend\Mvc\SendResponseListener:getEvent is called 1 times and took 0.066 ms
Zend\Mvc\MvcEvent:getRouter is called 1 times and took 0.073 ms
Zend\View\Helper\HeadTitle:getTranslatorTextDomain is called 1 times and took 0.075 ms
Zend\View\Helper\HeadTitle:getDefaultAttachOrder is called 1 times and took 0.076 ms
Zend\ModuleManager\Listener\ListenerOptions:getCheckDependencies is called 1 times and took 0.076 ms
Zend\Http\Header\Cookie:getFieldName is called 1 times and took 0.077 ms
Zend\View\ViewEvent:getResponse is called 1 times and took 0.079 ms
Zend\View\Helper\HeadMeta:getRegistry is called 1 times and took 0.081 ms
Zend\View\Helper\HeadTitle:getTranslator is called 1 times and took 0.082 ms
Zend\View\ViewEvent:getResult is called 1 times and took 0.083 ms
Zend\ModuleManager\ModuleEvent:getTarget is called 2 times and took 0.083 ms
Zend\View\ViewEvent:getRenderer is called 1 times and took 0.084 ms
Zend\ModuleManager\Listener\ListenerOptions:getConfigCacheEnabled is called 2 times and took 0.085 ms
Zend\ModuleManager\Listener\ListenerOptions:getModuleMapCacheEnabled is called 2 times and took 0.086 ms
Zend\View\Helper\Placeholder\Container:getPostfix is called 1 times and took 0.087 ms
Zend\View\Helper\Placeholder\Container:getPrefix is called 1 times and took 0.087 ms
Zend\ModuleManager\Listener\ConfigListener:getMergedConfig is called 2 times and took 0.089 ms
Zend\Mvc\Router\Http\TreeRouteStack:getRoutePluginManager is called 2 times and took 0.091 ms
Zend\View\Helper\InlineScript:getRegistry is called 1 times and took 0.091 ms
Zend\ModuleManager\Listener\DefaultListenerAggregate:getOptions is called 2 times and took 0.093 ms
Zend\View\Model\ViewModel:getIterator is called 1 times and took 0.093 ms
Zend\View\Helper\HeadScript:getRegistry is called 1 times and took 0.096 ms
Application\Module:getAutoloaderConfig is called 1 times and took 0.104 ms
Zend\Mvc\MvcEvent:getTarget is called 2 times and took 0.107 ms
Zend\View\HelperPluginManager:getServiceLocator is called 2 times and took 0.108 ms
Zend\View\Renderer\PhpRenderer:__get is called 1 times and took 0.114 ms
Zend\Mvc\Application:getResponse is called 3 times and took 0.116 ms
Zend\Uri\Http:getScheme is called 2 times and took 0.117 ms
Zend\Http\PhpEnvironment\Response:getStatusCode is called 3 times and took 0.118 ms
Zend\ModuleManager\ModuleEvent:getModuleName is called 3 times and took 0.122 ms
Zend\Mvc\Application:getMvcEvent is called 2 times and took 0.127 ms
Zend\View\View:getRequest is called 2 times and took 0.127 ms
Zend\View\View:getResponse is called 2 times and took 0.128 ms
Zend\Mvc\MvcEvent:setTarget is called 3 times and took 0.130 ms
Zend\Mvc\View\Http\ViewManager:getLayoutTemplate is called 2 times and took 0.134 ms
Zend\Uri\Http:getHost is called 2 times and took 0.145 ms
Zend\Escaper\Escaper:getEncoding is called 3 times and took 0.149 ms
Zend\View\Resolver\TemplateMapResolver:get is called 2 times and took 0.149 ms
Zend\Mvc\Application:getServiceManager is called 4 times and took 0.155 ms
Zend\View\Model\ViewModel:getVariables is called 2 times and took 0.157 ms
Zend\ModuleManager\ModuleManager:getEvent is called 4 times and took 0.158 ms
Zend\View\ViewEvent:setTarget is called 2 times and took 0.163 ms
Zend\Mvc\MvcEvent:getRequest is called 3 times and took 0.169 ms
Zend\Mvc\Router\PriorityList:get is called 2 times and took 0.171 ms
Zend\ModuleManager\ModuleEvent:setTarget is called 4 times and took 0.171 ms
Zend\View\Helper\Doctype:getDoctypes is called 3 times and took 0.181 ms
Zend\Uri\Http:getPath is called 3 times and took 0.181 ms
Zend\Mvc\MvcEvent:getRouteMatch is called 5 times and took 0.185 ms
Zend\View\Helper\HeadMeta:getIterator is called 1 times and took 0.186 ms
Zend\View\Helper\HeadLink:getIterator is called 1 times and took 0.190 ms
Zend\Mvc\MvcEvent:getResponse is called 4 times and took 0.190 ms
Zend\View\Helper\HeadScript:getIterator is called 1 times and took 0.192 ms
Zend\View\Model\ViewModel:getTemplate is called 3 times and took 0.193 ms
Zend\Http\PhpEnvironment\Request:getUri is called 3 times and took 0.198 ms
Zend\ModuleManager\Listener\ConfigListener:getOptions is called 5 times and took 0.198 ms
Zend\Mvc\MvcEvent:getApplication is called 5 times and took 0.216 ms
Zend\View\Model\ViewModel:getOptions is called 4 times and took 0.222 ms
Zend\View\View:getEventManager is called 3 times and took 0.234 ms
Zend\Mvc\Router\Http\RouteMatch:getParam is called 5 times and took 0.241 ms
Zend\View\Helper\HeadMeta:getContainer is called 6 times and took 0.251 ms
Zend\Mvc\ResponseSender\SendResponseEvent:getResponse is called 7 times and took 0.284 ms
Zend\View\Helper\InlineScript:getIterator is called 1 times and took 0.301 ms
Zend\Mvc\MvcEvent:getParam is called 6 times and took 0.316 ms
Zend\View\Helper\HeadTitle:getIterator is called 1 times and took 0.317 ms
Zend\Mvc\View\Http\ViewManager:getHelperManager is called 1 times and took 0.330 ms
Zend\Mvc\MvcEvent:getResult is called 8 times and took 0.334 ms
Zend\ModuleManager\Listener\ListenerOptions:getModulePaths is called 1 times and took 0.335 ms
Zend\ModuleManager\ModuleManager:getEventManager is called 9 times and took 0.336 ms
Zend\Mvc\Application:getEventManager is called 8 times and took 0.343 ms
Zend\View\Helper\Placeholder\Container:getIndent is called 5 times and took 0.352 ms
Zend\ServiceManager\Config:getShared is called 8 times and took 0.389 ms
Zend\ServiceManager\Config:getInitializers is called 8 times and took 0.406 ms
Zend\Stdlib\CallbackHandler:getMetadatum is called 7 times and took 0.413 ms
Zend\ServiceManager\Config:getServices is called 8 times and took 0.430 ms
Zend\ServiceManager\Config:getAliases is called 8 times and took 0.435 ms
Zend\ServiceManager\Config:getFactories is called 8 times and took 0.438 ms
Zend\View\Helper\HeadTitle:getContainer is called 7 times and took 0.446 ms
Zend\ServiceManager\Config:getInvokables is called 8 times and took 0.458 ms
Zend\View\Helper\HeadScript:getContainer is called 11 times and took 0.460 ms
Zend\Http\PhpEnvironment\Request:getServer is called 6 times and took 0.479 ms
Zend\ServiceManager\Config:getAllowOverride is called 8 times and took 0.486 ms
Zend\ServiceManager\Config:getAbstractFactories is called 8 times and took 0.509 ms
Zend\Mvc\ResponseSender\SendResponseEvent:getParam is called 2 times and took 0.511 ms
Zend\View\Helper\Doctype:getDoctype is called 10 times and took 0.514 ms
Zend\View\Helper\HeadScript:getEscaper is called 6 times and took 0.521 ms
Zend\View\Helper\InlineScript:getContainer is called 5 times and took 0.530 ms
Zend\View\Helper\Placeholder\Container:getSeparator is called 5 times and took 0.533 ms
Zend\View\HelperPluginManager:getRenderer is called 10 times and took 0.540 ms
Zend\Stdlib\Parameters:get is called 10 times and took 0.634 ms
Zend\I18n\View\Helper\Translate:getTranslatorTextDomain is called 16 times and took 0.642 ms
Zend\View\Helper\HeadLink:getContainer is called 12 times and took 0.650 ms
Application\Controller\IndexController:getEventManager is called 3 times and took 0.704 ms
Zend\I18n\Translator\Translator:getLocale is called 17 times and took 0.755 ms
Zend\I18n\View\Helper\Translate:getTranslator is called 16 times and took 0.762 ms
Zend\I18n\Translator\Translator:getFallbackLocale is called 17 times and took 0.844 ms
Zend\Http\PhpEnvironment\Request:getBasePath is called 1 times and took 0.917 ms
Zend\View\Renderer\PhpRenderer:getHelperPluginManager is called 21 times and took 1.016 ms
Zend\View\Helper\HeadLink:getEscaper is called 16 times and took 1.066 ms
Zend\Http\PhpEnvironment\Request:getRequestUri is called 2 times and took 1.163 ms
Zend\Mvc\MvcEvent:getError is called 6 times and took 1.221 ms
Zend\ModuleManager\ModuleEvent:getModule is called 7 times and took 1.319 ms
Zend\EventManager\EventManager:getIdentifiers is called 32 times and took 1.420 ms
Zend\EventManager\EventManager:getSharedManager is called 35 times and took 1.634 ms
Zend\View\View:getEvent is called 2 times and took 1.877 ms
Zend\Http\PhpEnvironment\Request:getBaseUrl is called 2 times and took 2.653 ms
Application\Module:getConfig is called 1 times and took 2.752 ms
Zend\EventManager\EventManager:getListeners is called 44 times and took 3.021 ms
Zend\Stdlib\CallbackHandler:getCallback is called 33 times and took 3.112 ms
Zend\I18n\Translator\Translator:getPluginManager is called 1 times and took 4.734 ms
Zend\Http\PhpEnvironment\Request:getHeaders is called 2 times and took 5.536 ms
Zend\View\Helper\HeadMeta:getEscaper is called 3 times and took 6.067 ms
Zend\Mvc\View\Http\ViewManager:getExceptionStrategy is called 1 times and took 7.157 ms
Zend\Mvc\View\Http\ViewManager:getRouteNotFoundStrategy is called 1 times and took 7.247 ms
Zend\View\Renderer\PhpRenderer:getFilterChain is called 2 times and took 7.302 ms
Zend\EventManager\SharedEventManager:getListeners is called 110 times and took 8.856 ms
Zend\Stdlib\PriorityQueue:getIterator is called 34 times and took 9.026 ms
Zend\Stdlib\PriorityQueue:getQueue is called 84 times and took 10.376 ms
Zend\ModuleManager\Listener\DefaultListenerAggregate:getConfigListener is called 1 times and took 10.764 ms
Zend\View\Helper\Placeholder\Registry:getContainer is called 5 times and took 18.221 ms
Zend\Mvc\MvcEvent:getViewModel is called 3 times and took 22.603 ms
Zend\Mvc\View\Http\ViewManager:getViewModel is called 1 times and took 22.931 ms
Zend\I18n\Translator\LoaderPluginManager:get is called 2 times and took 24.612 ms
Zend\Mvc\SendResponseListener:getEventManager is called 4 times and took 28.525 ms
Zend\I18n\Translator\Translator:getTranslatedMessage is called 17 times and took 29.266 ms
Zend\EventManager\EventManager:getSharedListeners is called 32 times and took 41.810 ms
Zend\Mvc\Router\RoutePluginManager:get is called 6 times and took 44.456 ms
Zend\Mvc\View\Http\ViewManager:getResolver is called 1 times and took 55.789 ms
Zend\Mvc\Controller\ControllerManager:get is called 3 times and took 81.379 ms
Zend\Mvc\View\Http\ViewManager:getRenderer is called 1 times and took 121.705 ms
Zend\Mvc\View\Http\ViewManager:getRendererStrategy is called 1 times and took 131.857 ms
Zend\Mvc\View\Http\ViewManager:getView is called 1 times and took 150.598 ms
Zend\Mvc\View\Http\ViewManager:getMvcRenderingStrategy is called 1 times and took 158.219 ms
Zend\View\HelperPluginManager:get is called 42 times and took 294.154 ms
Zend\ServiceManager\ServiceManager:get is called 59 times and took 927.239 ms
<?php
namespace Aspect;
use Go\Aop\Aspect;
use Go\Aop\Intercept\MethodInvocation;
use Go\Lang\Annotation\After;
use Go\Lang\Annotation\AfterThrowing;
use Go\Lang\Annotation\Before;
use Go\Lang\Annotation\Around;
use Go\Lang\Annotation\Pointcut;
/**
* Getter logger aspect
*/
class GetterLoggerAspect implements Aspect
{
public function __destruct()
{
uasort($this->times, function ($first, $second) {
return $first['time'] < $second['time'] ? -1 : 1;
});
foreach ($this->times as $key=>$value) {
echo $key, ' is called ', $value['count'], ' times and took ', number_format($value['time'] * 1e3, 3), " ms<br>\n";
}
}
/**
* Method that should be called around real method
*
* @param MethodInvocation $invocation Invocation
* @Around("within(**) && execution(* **->*get*(*))")
*/
public function beforeMethodExecution(MethodInvocation $invocation)
{
$obj = $invocation->getThis();
$class = is_object($obj) ? get_class($obj) : $obj;
$method = $invocation->getMethod()->getName();
$time = microtime(true);
$result = $invocation->proceed();
$total = microtime(true);
if (isset($this->times["$class:$method"])) {
$this->times["$class:$method"]['count']++;
$this->times["$class:$method"]['time'] += ($total-$time);
} else {
$this->times["$class:$method"]['count'] = 1;
$this->times["$class:$method"]['time'] = ($total-$time);
}
return $result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment