• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Profiler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: WebLauncher

 /**
  * Launches a test module for web inspection of results
  * @param string $module
  * @return boolean
  */
 function WebLauncher($module)
 {
     jf::$ErrorHandler->UnsetErrorHandler();
     $this->LoadFramework();
     self::$TestSuite = new \PHPUnit_Framework_TestSuite();
     self::$TestFiles[] = $this->ModuleFile($module);
     self::$TestSuite->addTestFile(self::$TestFiles[0]);
     $result = new \PHPUnit_Framework_TestResult();
     $listener = new TestListener();
     $result->addListener($listener);
     $Profiler = new Profiler();
     if (function_exists("xdebug_start_code_coverage")) {
         xdebug_start_code_coverage();
     }
     self::$TestSuite->run($result);
     if (function_exists("xdebug_start_code_coverage")) {
         $Coverage = xdebug_get_code_coverage();
     } else {
         $Coverage = null;
     }
     $Profiler->Stop();
     $listener->Finish();
     $this->OutputResult($result, $Profiler, $Coverage);
     return true;
 }
开发者ID:michalkoczwara,项目名称:WebGoatPHP,代码行数:30,代码来源:test.php


示例2: admin_page_bottom

 static function admin_page_bottom($theme)
 {
     if (Session::instance()->get("profiler", false)) {
         $profiler = new Profiler();
         $profiler->render();
     }
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:7,代码来源:core_theme.php


示例3: testSqlNumRows

 public function testSqlNumRows()
 {
     // Simulate three queries
     $this->profiler->sqlProfiler("some query");
     $this->profiler->sqlProfiler("some query");
     $this->profiler->sqlProfiler("some query");
     // Do not stop the profilers, jump right to the assertions
     // How evil!
     self::assertEquals(3, $this->profiler->getNumQueries());
 }
开发者ID:apexstudios,项目名称:yamwlib,代码行数:10,代码来源:ProfilerTest.php


示例4: admin_page_bottom

 static function admin_page_bottom($theme)
 {
     $session = Session::instance();
     if ($session->get("profiler", false)) {
         $profiler = new Profiler();
         $profiler->render();
     }
     if ($session->get("l10n_mode", false)) {
         return L10n_Client_Controller::l10n_form();
     }
 }
开发者ID:scarygary,项目名称:gallery3,代码行数:11,代码来源:gallery_theme.php


示例5: run

 /**
  * Run script
  *
  */
 public function run()
 {
     try {
         $content = $this->_factory->getModel('crawlerModel')->crawl($this->_args);
         //array of data to render
         $result = array();
         $sortArr = array();
         foreach ($content as $key => $data) {
             $time = $data['time'];
             Profiler::start($key);
             $renderData = TagCounterHelper::count($data['content'], 'img');
             Profiler::stop($key);
             $time += Profiler::fetch($key);
             array_push($result, array($key, (int) $renderData['img'], $time));
             array_push($sortArr, $renderData['img']);
         }
         array_multisort($sortArr, SORT_DESC, $result);
         if (!empty($result)) {
             array_unshift($result, $this->_tableHeaders);
         }
         ViewHelper::getRenderer()->process(array('grid' => $result));
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:alex311982,项目名称:crawler,代码行数:29,代码来源:crawler.php


示例6: delete

	/**
	 * Overload Sprig::delete() to update child articles
	 * to become children of the uncategorized subcategory
	 */
	public function delete(Database_Query_Builder_Delete $query = NULL) {
		Kohana::$log->add(Kohana::DEBUG, 'Beginning subcategory deletion for subcategory_id='.$this->id);
		if (Kohana::$profiling === TRUE)
		{
			$benchmark = Profiler::start('blog', 'delete subcategory');
		}

		$uncategorized = Sprig::factory('subcategory', array('name'=>'uncategorized'))->load();

		// Modify category IDs for all child articles
		try
		{
			DB::update('articles')->value('subcategory_id', $uncategorized->id)
				->where('subcategory_id', '=', $this->id)->execute();
		}
		catch (Database_Exception $e)
		{
			Kohana::$log->add(Kohana::ERROR, 'Exception occured while modifying deleted subcategory\'s articles. '.$e->getMessage());
			return $this;
		}

		if (isset($benchmark))
		{
			Profiler::stop($benchmark);
		}

		return parent::delete($query);
	}
开发者ID:nagius,项目名称:kohana-blog,代码行数:32,代码来源:subcategory.php


示例7: query

 public function query($type, $sql, $as_object)
 {
     if (isset($this->_config['connection']) === true) {
         $this->database = $this->_config['connection']['database'];
     }
     $result = parent::query($type, $sql, false);
     if ($type === Database::SELECT) {
         $table = array();
         if (count($result) > 0) {
             foreach ($result->current() as $key => $data) {
                 $table[0][] = $key;
             }
             $result->rewind();
             foreach ($result as $row) {
                 $table[] = $row;
             }
             $result->rewind();
         } else {
             $table[] = array('No', 'rows');
         }
         $group = Profiler::groups();
         $group = Profiler::total($group['database (default)'][$sql][0]);
         FirePHP::getInstance()->table($this->database . ' : (' . number_format($group[0], 6) . 's) ' . $sql, $table);
     } elseif ($type === Database::INSERT) {
         FirePHP::getInstance()->info($this->database . ' : Insert id: ' . $result[0] . ' Affected rows: ' . $result[1]);
     } else {
         FirePHP::getInstance()->info($this->database . ' : Affected rows: ' . $result[0]);
     }
     return $result;
 }
开发者ID:pedrosland,项目名称:kohana-firephp,代码行数:30,代码来源:mysql.php


示例8: load

 /**
  * Returns the translation table for a given language.
  *
  *     // Get all defined Spanish messages
  *     $messages = I18n::load('es-es');
  * 
  * После генерации таблицы происходит создание Javascript файла с таблицей
  * перевода для загружаемого языка.
  *
  * @param   string  $lang   language to load
  * @return  array
  */
 public static function load($lang)
 {
     $table = parent::load($lang);
     $filename = Kohana::$cache_dir . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, array('i18n', NULL)) . $lang . '.js';
     if (!file_exists($filename) or file_exists($filename) and time() - filemtime($filename) > Date::DAY) {
         if (Kohana::$profiling === TRUE and class_exists('Profiler', FALSE)) {
             // Start a new benchmark
             $benchmark = Profiler::start('i18n', 'Generate file for lang - ' . $lang);
         }
         try {
             // Create the log file
             file_put_contents($filename, '// Auto generated i18n lang file for lang ' . $lang . ". Created on " . date('Y-m-d H:i:s') . "\n");
             file_put_contents($filename, 'cms.addTranslation(' . json_encode($table) . ');', FILE_APPEND);
             // Allow anyone to write to log files
             chmod($filename, 0777);
         } catch (Exception $e) {
             // do something
         }
         if (isset($benchmark)) {
             // Stop the benchmark
             Profiler::stop($benchmark);
         }
     }
     return $table;
 }
开发者ID:ortodesign,项目名称:cms,代码行数:37,代码来源:i18n.php


示例9: __construct

 public function __construct($id = NULL)
 {
     Kohana::$profiling === TRUE && ($bm = Profiler::start('ORM', __FUNCTION__));
     parent::__construct($id);
     $this->after_initialize();
     isset($bm) && Profiler::stop($bm);
 }
开发者ID:alshabalin,项目名称:kohana-advanced-orm,代码行数:7,代码来源:ORM.php


示例10: cache

 /**
  * Cache data.
  *
  * @return  void
  */
 public static function cache()
 {
     if (!Profiler::show('cache')) {
         return;
     }
     $queries = Cache::$queries;
     $table = new Profiler_Table();
     $table->add_column();
     $table->add_column('kp-column kp-data');
     $table->add_column('kp-column kp-data');
     $table->add_column('kp-column kp-data');
     $table->add_row(array('Cache', 'Gets', 'Sets', 'Deletes'), 'kp-title', 'background-color: #E0FFE0');
     text::alternate();
     $total_gets = $total_sets = $total_deletes = 0;
     $total_requests = array();
     foreach ($queries as $type => $requests) {
         foreach ($requests as $query) {
             if (!isset($total_requests[$query])) {
                 $total_requests[$query] = array('gets' => 0, 'sets' => 0, 'deletes' => 0);
             }
             $total_requests[$query][$type]++;
         }
     }
     foreach ($total_requests as $query => $types) {
         $data = array($query, $types['gets'], $types['sets'], $types['deletes']);
         $class = text::alternate('', 'kp-altrow');
         $table->add_row($data, $class);
         $total_gets += $types['gets'];
         $total_sets += $types['sets'];
         $total_deletes += $types['deletes'];
     }
     $data = array('Total: ' . count($total_requests), $total_gets, $total_sets, $total_deletes);
     $table->add_row($data, 'kp-totalrow');
     Profiler::add($table);
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:40,代码来源:MY_Profiler.php


示例11: stopQuery

 public function stopQuery()
 {
     if ($this->benchmark) {
         \Profiler::stop($this->benchmark);
         $this->benchmark = null;
     }
 }
开发者ID:aspendigital,项目名称:fuel-doctrine2,代码行数:7,代码来源:Logger.php


示例12: get_smarty

 public static function get_smarty()
 {
     if (isset(self::$smarty)) {
         return self::$smarty;
     }
     $token = Kohana::$profiling ? Profiler::start('smarty', 'load smarty') : false;
     $config = Kohana::config('smarty');
     try {
         include $config->smarty_class_file;
     } catch (Exception $e) {
         throw new Kohana_Exception('Could not load Smarty class file');
     }
     $smarty = new Smarty();
     // deal with initial config
     $smarty->php_handling = constant($config->php_handling);
     // deal with main config
     foreach ($config->smarty_config as $key => $value) {
         $smarty->{$key} = $value;
     }
     // check we can write to the compiled templates directory
     if (!is_writeable($smarty->compile_dir)) {
         self::create_dir($smarty->compile_dir, 'Smarty compiled template');
     }
     // if smarty caching is enabled, check we can write to the cache directory
     if ($smarty->caching && !is_writeable($smarty->cache_dir)) {
         self::create_dir($smarty->cache_dir, 'Smarty cache');
     }
     self::$smarty = $smarty;
     $token ? Profiler::stop($token) : null;
     return $smarty;
 }
开发者ID:pg7812,项目名称:kohana-module-smarty,代码行数:31,代码来源:smarty.php


示例13: action_change

 public function action_change()
 {
     //トークンの生成
     $this->action_csrf();
     //バリデーション定義
     $val = Validation::forge();
     $val->add('password', '「現在のパスワード」')->add_rule('required')->add_rule('min_length', 8)->add_rule('max_length', 12);
     $val->add('newpassword', '「新しいパスワード」または、「(新)パスワード再入力」')->add_rule('required')->add_rule('min_length', 8)->add_rule('max_length', 12);
     $this->action_category();
     if (Input::post()) {
         if (Security::check_token()) {
             if ($val->run()) {
                 $username = Auth::get_screen_name();
                 //現在のパスワード
                 $old_password = Input::post('password');
                 //新しいパスワード
                 $new_password = Input::post('newpassword');
                 //パスワードを変更するメソッド
                 Auth::change_password($old_password, $new_password, $username);
                 $this->message = 'パスワードが変更されました。';
                 $view = View::forge('changepass/ChangePass', $this->data);
                 $view->set_global('message', $this->message, false);
                 $view->set_global('error', $this->error, false);
             } else {
                 $this->error = $val->error();
                 $view = View::forge('changepass/ChangePass', $this->data);
                 $view->set_global('message', $this->message, false);
                 $view->set_global('error', $this->error, false);
             }
         } else {
             Profiler::mark('CSRF攻撃');
         }
     }
     return $view;
 }
开发者ID:nihonLoomba,项目名称:noteshare-,代码行数:35,代码来源:changepass.php


示例14: execute

 /**
  * Main execution point
  *
  * @param null|string $code Confirmation code passed to the page
  * @throws PermissionsError
  * @throws ReadOnlyError
  * @throws UserNotLoggedIn
  */
 function execute($code)
 {
     // Ignore things like master queries/connections on GET requests.
     // It's very convenient to just allow formless link usage.
     $trxProfiler = Profiler::instance()->getTransactionProfiler();
     $this->setHeaders();
     $this->checkReadOnly();
     $this->checkPermissions();
     // This could also let someone check the current email address, so
     // require both permissions.
     if (!$this->getUser()->isAllowed('viewmyprivateinfo')) {
         throw new PermissionsError('viewmyprivateinfo');
     }
     if ($code === null || $code === '') {
         $this->requireLogin('confirmemail_needlogin');
         if (Sanitizer::validateEmail($this->getUser()->getEmail())) {
             $this->showRequestForm();
         } else {
             $this->getOutput()->addWikiMsg('confirmemail_noemail');
         }
     } else {
         $old = $trxProfiler->setSilenced(true);
         $this->attemptConfirm($code);
         $trxProfiler->setSilenced($old);
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:34,代码来源:SpecialConfirmemail.php


示例15: __construct

 /**
  * The Symphony constructor initialises the class variables of Symphony.
  * It will set the DateTime settings, define new date constants and initialise
  * the correct Language for the currently logged in Author. If magic quotes
  * are enabled, Symphony will sanitize the `$_SERVER`, `$_COOKIE`,
  * `$_GET` and `$_POST` arrays. The constructor loads in
  * the initial Configuration values from the `CONFIG` file
  */
 protected function __construct()
 {
     self::$Profiler = Profiler::instance();
     self::$Profiler->sample('Engine Initialisation');
     if (get_magic_quotes_gpc()) {
         General::cleanArray($_SERVER);
         General::cleanArray($_COOKIE);
         General::cleanArray($_GET);
         General::cleanArray($_POST);
     }
     $this->initialiseConfiguration();
     define_safe('__SYM_DATE_FORMAT__', self::Configuration()->get('date_format', 'region'));
     define_safe('__SYM_TIME_FORMAT__', self::Configuration()->get('time_format', 'region'));
     define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . self::Configuration()->get('datetime_separator', 'region') . __SYM_TIME_FORMAT__);
     DateTimeObj::setSettings(self::Configuration()->get('region'));
     // Initialize language management
     Lang::initialize();
     $this->initialiseLog();
     GenericExceptionHandler::initialise(self::Log());
     GenericErrorHandler::initialise(self::Log());
     $this->initialiseDatabase();
     $this->initialiseExtensionManager();
     $this->initialiseCookie();
     // If the user is not a logged in Author, turn off the verbose error messages.
     if (!self::isLoggedIn() && is_null($this->Author)) {
         GenericExceptionHandler::$enabled = false;
     }
     // Set system language
     Lang::set(self::$Configuration->get('lang', 'symphony'));
 }
开发者ID:readona,项目名称:symphonyno5,代码行数:38,代码来源:class.symphony.php


示例16: show

 /**
  * purge is slightly weird because it can be either formed or formless depending
  * on user permissions
  */
 public function show()
 {
     $this->setHeaders();
     // This will throw exceptions if there's a problem
     $this->checkCanExecute($this->getUser());
     $user = $this->getUser();
     if ($user->pingLimiter('purge')) {
         // TODO: Display actionthrottledtext
         return;
     }
     if ($user->isAllowed('purge')) {
         // This will update the database immediately, even on HTTP GET.
         // Lots of uses may exist for this feature, so just ignore warnings.
         Profiler::instance()->getTransactionProfiler()->resetExpectations();
         $this->redirectParams = wfArrayToCgi(array_diff_key($this->getRequest()->getQueryValues(), ['title' => null, 'action' => null]));
         if ($this->onSubmit([])) {
             $this->onSuccess();
         }
     } else {
         $this->redirectParams = $this->getRequest()->getVal('redirectparams', '');
         $form = $this->getForm();
         if ($form->show()) {
             $this->onSuccess();
         }
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:30,代码来源:PurgeAction.php


示例17: getInstance

 /**
  * Get singleton instance
  * @return Profiler
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new Profiler();
     }
     return self::$instance;
 }
开发者ID:unruthless,项目名称:ThinkUp,代码行数:11,代码来源:class.Profiler.php


示例18: __construct

 public function __construct($file = null, array $data = null)
 {
     $token = Kohana::$profiling ? Profiler::start('renderer', 'new kohana view') : false;
     $this->_config = Kohana::config('render');
     parent::__construct($file, $data);
     $token ? Profiler::stop($token) : null;
 }
开发者ID:pg7812,项目名称:kohana-module-smarty,代码行数:7,代码来源:view.php


示例19: __construct

 /**
  * The Symphony constructor initialises the class variables of Symphony.
  * It will set the DateTime settings, define new date constants and initialise
  * the correct Language for the currently logged in Author. If magic quotes
  * are enabled, Symphony will sanitize the `$_SERVER`, `$_COOKIE`,
  * `$_GET` and `$_POST` arrays. The constructor loads in
  * the initial Configuration values from the `CONFIG` file
  */
 protected function __construct()
 {
     $this->Profiler = Profiler::instance();
     $this->Profiler->sample('Engine Initialisation');
     if (get_magic_quotes_gpc()) {
         General::cleanArray($_SERVER);
         General::cleanArray($_COOKIE);
         General::cleanArray($_GET);
         General::cleanArray($_POST);
     }
     // Includes the existing CONFIG file and initialises the Configuration
     // by setting the values with the setArray function.
     include CONFIG;
     self::$Configuration = new Configuration(true);
     self::$Configuration->setArray($settings);
     DateTimeObj::setDefaultTimezone(self::$Configuration->get('timezone', 'region'));
     define_safe('__SYM_DATE_FORMAT__', self::$Configuration->get('date_format', 'region'));
     define_safe('__SYM_TIME_FORMAT__', self::$Configuration->get('time_format', 'region'));
     define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . self::$Configuration->get('datetime_separator', 'region') . __SYM_TIME_FORMAT__);
     // Initialize language management
     Lang::initialize();
     $this->initialiseLog();
     GenericExceptionHandler::initialise(self::$Log);
     GenericErrorHandler::initialise(self::$Log, self::$Configuration->get('strict_error_handling', 'symphony'));
     $this->initialiseDatabase();
     $this->initialiseExtensionManager();
     $this->initialiseCookie();
     // If the user is not a logged in Author, turn off the verbose error
     // messages.
     if (!self::isLoggedIn() && is_null($this->Author)) {
         GenericExceptionHandler::$enabled = false;
     }
     // Set system language
     Lang::set(self::$Configuration->get('lang', 'symphony'));
 }
开发者ID:scottkf,项目名称:keepflippin--on-symphony,代码行数:43,代码来源:class.symphony.php


示例20: execute

 public function execute($db = 'default')
 {
     if (!is_object($db)) {
         // Get the database instance
         $db = Database::instance($db);
     }
     // Import the SQL locally
     $sql = $this->_sql;
     if (!empty($this->_values)) {
         // Quote all of the values
         $values = array_map(array($db, 'quote'), $this->_values);
         // Replace the values in the SQL
         $sql = strtr($sql, $values);
     }
     if ($this->profile === TRUE) {
         // Start profiling this query
         $token = Profiler::start('database (' . (string) $db . ')', $sql);
     }
     // Load the result
     $result = $db->query($this->_type, $sql);
     if (isset($token)) {
         // Stop profiling
         Profiler::stop($token);
     }
     return $result;
 }
开发者ID:ukd1,项目名称:kohana,代码行数:26,代码来源:query.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Program类代码示例发布时间:2022-05-23
下一篇:
PHP Profile_User类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap