当前位置: 首页>>代码示例>>PHP>>正文


PHP Benchmark::f_start方法代码示例

本文整理汇总了PHP中Benchmark::f_start方法的典型用法代码示例。如果您正苦于以下问题:PHP Benchmark::f_start方法的具体用法?PHP Benchmark::f_start怎么用?PHP Benchmark::f_start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Benchmark的用法示例。


在下文中一共展示了Benchmark::f_start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ReflectionClass

 /**
  * Loads the controller and initializes it. Runs the pre_controller,
  * post_controller_constructor, and post_controller events. Triggers
  * a system.404 event when the route cannot be mapped to a controller.
  *
  * This method is benchmarked as controller_setup and controller_execution.
  *
  * @return  object  instance of controller
  */
 public static function &instance()
 {
     if (self::$instance === NULL) {
         Benchmark::start(SYSTEM_BENCHMARK . '_controller_setup');
         if (Router::$method[0] === '_') {
             // Do not allow access to hidden methods
             Event::run('system.404');
         }
         // Include the Controller file
         require Router::$controller_path;
         try {
             // Start validation of the controller
             $class = new ReflectionClass(ucfirst(Router::$controller) . '_Controller');
         } catch (ReflectionException $e) {
             // Controller does not exist
             Event::run('system.404');
         }
         if ($class->isAbstract() or IN_PRODUCTION and $class->getConstant('ALLOW_PRODUCTION') == FALSE) {
             // Controller is not allowed to run in production
             Event::run('system.404');
         }
         // Run system.pre_controller
         Event::run('system.pre_controller');
         // Begin benchmark for the controller
         Benchmark::f_start(ucfirst(Router::$controller) . '_Controller');
         // Create a new controller instance
         $controller = $class->newInstance();
         // End benchmark for the controller
         Benchmark::f_stop(ucfirst(Router::$controller) . '_Controller');
         // Controller constructor has been executed
         Event::run('system.post_controller_constructor');
         try {
             // Load the controller method
             $method = $class->getMethod(Router::$method);
             if ($method->isProtected() or $method->isPrivate()) {
                 // Do not attempt to invoke protected methods
                 throw new ReflectionException('protected controller method');
             }
             // Default arguments
             $arguments = Router::$arguments;
         } catch (ReflectionException $e) {
             // Use __call instead
             $method = $class->getMethod('__call');
             // Use arguments in __call format
             $arguments = array(Router::$method, Router::$arguments);
         }
         // Stop the controller setup benchmark
         Benchmark::stop(SYSTEM_BENCHMARK . '_controller_setup');
         // Start the controller execution benchmark
         Benchmark::start(SYSTEM_BENCHMARK . '_controller_execution');
         // Execute the controller method
         $method->invokeArgs($controller, $arguments);
         // Controller method has been executed
         Event::run('system.post_controller');
         // Stop the controller execution benchmark
         Benchmark::stop(SYSTEM_BENCHMARK . '_controller_execution');
     }
     return self::$instance;
 }
开发者ID:nanangsyaifudin,项目名称:HAC-2012,代码行数:68,代码来源:Kohana.php


注:本文中的Benchmark::f_start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。