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


PHP Profiler::stop方法代码示例

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


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

示例1: dispatch

 /**
  * Perform action and generate response
  *
  * @param RequestInterface $request
  * @return ResponseInterface|\Magento\Framework\Controller\ResultInterface
  * @throws \LogicException
  */
 public function dispatch(RequestInterface $request)
 {
     \Magento\Framework\Profiler::start('routers_match');
     $routingCycleCounter = 0;
     $result = null;
     while (!$request->isDispatched() && $routingCycleCounter++ < 100) {
         /** @var \Magento\Framework\App\RouterInterface $router */
         foreach ($this->_routerList as $router) {
             try {
                 $actionInstance = $router->match($request);
                 if ($actionInstance) {
                     $request->setDispatched(true);
                     $this->response->setNoCacheHeaders();
                     if ($actionInstance instanceof \Magento\Framework\App\Action\AbstractAction) {
                         $result = $actionInstance->dispatch($request);
                     } else {
                         $result = $actionInstance->execute();
                     }
                     break;
                 }
             } catch (\Magento\Framework\Exception\NotFoundException $e) {
                 $request->initForward();
                 $request->setActionName('noroute');
                 $request->setDispatched(false);
                 break;
             }
         }
     }
     \Magento\Framework\Profiler::stop('routers_match');
     if ($routingCycleCounter > 100) {
         throw new \LogicException('Front controller reached 100 router match iterations');
     }
     return $result;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:41,代码来源:FrontController.php

示例2: execute

 public function execute()
 {
     $resultPage = $this->resultPageFactory->create();
     \Magento\Framework\Profiler::start('foggyline:office');
     $this->logger->log(\Monolog\Logger::DEBUG, 'debug msg');
     $this->logger->log(\Monolog\Logger::INFO, 'info msg');
     $this->logger->log(\Monolog\Logger::NOTICE, 'notice msg');
     $this->logger->log(\Monolog\Logger::WARNING, 'warning msg');
     $this->logger->log(\Monolog\Logger::ERROR, 'error msg');
     $this->logger->log(\Monolog\Logger::CRITICAL, 'critical msg');
     $this->logger->log(\Monolog\Logger::ALERT, 'alert msg');
     $this->logger->log(\Monolog\Logger::EMERGENCY, 'emergency msg');
     $this->logger->debug('debug msg');
     $this->logger->info('info msg');
     $this->logger->notice('notice msg');
     $this->logger->warning('warning msg');
     $this->logger->error('error msg');
     $this->logger->critical('critical msg');
     $this->logger->alert('alert msg');
     $this->logger->emergency('emergency msg');
     sleep(2);
     /* code block or single expression here */
     \Magento\Framework\Profiler::stop('foggyline:office');
     return $resultPage;
 }
开发者ID:ksz2013,项目名称:m2-foggyline-office,代码行数:25,代码来源:Logging.php

示例3: _toHtml

 /**
  * Get html code
  *
  * @return string
  */
 protected function _toHtml()
 {
     /* @var $template \Magento\Newsletter\Model\Template */
     $template = $this->_templateFactory->create();
     if ($id = (int) $this->getRequest()->getParam('id')) {
         $this->loadTemplate($template, $id);
     } else {
         $previewData = $this->getPreviewData();
         $template->setTemplateType($previewData['type']);
         $template->setTemplateText($previewData['text']);
         $template->setTemplateStyles($previewData['styles']);
     }
     \Magento\Framework\Profiler::start($this->profilerName);
     $vars = [];
     $vars['subscriber'] = $this->_subscriberFactory->create();
     if ($this->getRequest()->getParam('subscriber')) {
         $vars['subscriber']->load($this->getRequest()->getParam('subscriber'));
     }
     $template->emulateDesign($this->getStoreId());
     $templateProcessed = $this->_appState->emulateAreaCode(\Magento\Newsletter\Model\Template::DEFAULT_DESIGN_AREA, [$template, 'getProcessedTemplate'], [$vars]);
     $template->revertDesign();
     if ($template->isPlain()) {
         $templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
     }
     \Magento\Framework\Profiler::stop($this->profilerName);
     return $templateProcessed;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:32,代码来源:Preview.php

示例4: _toHtml

 /**
  * Get html code
  *
  * @return string
  */
 protected function _toHtml()
 {
     /* @var $template \Magento\Newsletter\Model\Template */
     $template = $this->_templateFactory->create();
     if ($id = (int) $this->getRequest()->getParam('id')) {
         $template->load($id);
     } else {
         $template->setTemplateType($this->getRequest()->getParam('type'));
         $template->setTemplateText($this->getRequest()->getParam('text'));
         $template->setTemplateStyles($this->getRequest()->getParam('styles'));
     }
     $storeId = (int) $this->getRequest()->getParam('store_id');
     if (!$storeId) {
         $storeId = $this->_storeManager->getDefaultStoreView()->getId();
     }
     \Magento\Framework\Profiler::start("newsletter_template_proccessing");
     $vars = array();
     $vars['subscriber'] = $this->_subscriberFactory->create();
     if ($this->getRequest()->getParam('subscriber')) {
         $vars['subscriber']->load($this->getRequest()->getParam('subscriber'));
     }
     $template->emulateDesign($storeId);
     $templateProcessed = $this->_appState->emulateAreaCode(\Magento\Newsletter\Model\Template::DEFAULT_DESIGN_AREA, array($template, 'getProcessedTemplate'), array($vars, true));
     $template->revertDesign();
     if ($template->isPlain()) {
         $templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
     }
     \Magento\Framework\Profiler::stop("newsletter_template_proccessing");
     return $templateProcessed;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:35,代码来源:Preview.php

示例5: _toHtml

 /**
  * Prepare html output
  *
  * @return string
  */
 protected function _toHtml()
 {
     /** @var $template \Magento\Email\Model\Template */
     $template = $this->_emailFactory->create(['data' => ['area' => \Magento\Framework\App\Area::AREA_FRONTEND]]);
     $id = (int) $this->getRequest()->getParam('id');
     if ($id) {
         $template->load($id);
     } else {
         $template->setTemplateType($this->getRequest()->getParam('type'));
         $template->setTemplateText($this->getRequest()->getParam('text'));
         $template->setTemplateStyles($this->getRequest()->getParam('styles'));
     }
     $template->setTemplateText($this->_maliciousCode->filter($template->getTemplateText()));
     \Magento\Framework\Profiler::start("email_template_proccessing");
     $vars = [];
     $store = $this->getAnyStoreView();
     $storeId = $store ? $store->getId() : null;
     $template->setDesignConfig(['area' => $this->_design->getArea(), 'store' => $storeId]);
     $templateProcessed = $template->getProcessedTemplate($vars, true);
     if ($template->isPlain()) {
         $templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
     }
     \Magento\Framework\Profiler::stop("email_template_proccessing");
     return $templateProcessed;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:30,代码来源:Preview.php

示例6: logStats

 /**
  *
  * {@inheritdoc}
  */
 public function logStats($type, $sql, $bind = [], $result = null)
 {
     $log = [];
     //Change approach to "around" and then break return string into MySQL columns
     //  as right now we cannot get time of query execution
     //Problem remains how to pass the YES/NO on time and full backtrace
     // maybe its best to simply record all and then remove it from __destruct
     // as in __destruct we have access to helper
     // trace log and all log simply kill the database size, thus we need them as config
     self::$counter++;
     \Magento\Framework\Profiler::start('foggyline_sentinel_logStats_' . self::$counter);
     $log['type'] = $type;
     $log['time'] = sprintf('%.4f', microtime(true) - $this->timer);
     $log['sql'] = $sql;
     $log['bind'] = var_export($bind, true);
     if ($result instanceof \Zend_Db_Statement_Pdo) {
         $log['row_count'] = $result->rowCount();
     }
     /**
      * When backtrace is assigned, it consumes roughly:
      *  - 0.3 seconds on homepage,
      *  - 0.5 seconds on admin product page
      *
      * Problem here is that we cannot control Debug::backtrace via Magento admin config, so we have to leave it
      * either running or comment it out. If we leave it running, we can add some minor tome to overhead but we
      * can then use $this->helper->getQueryLogCallStack(); to either save it in database or not.
      *
      * Backtrace adds enormous amount of data to database. We are talking MB of data just in 3-4 page requests.
      * Thus it is highly important be very careful with full log stack (backtrace) loging to dataabse.
      */
     $log['backtrace'] = \Magento\Framework\Debug::backtrace(true, false);
     $this->queryLogs[] = $log;
     \Magento\Framework\Profiler::stop('foggyline_sentinel_logStats_' . self::$counter);
 }
开发者ID:ajzele,项目名称:Foggyline_Sentinel,代码行数:38,代码来源:File.php

示例7: applyRewrites

 /**
  * Apply rewrites to current request
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return void
  */
 public function applyRewrites(\Magento\Framework\App\RequestInterface $request)
 {
     // URL rewrite
     if (!$request->isStraight()) {
         \Magento\Framework\Profiler::start('db_url_rewrite');
         /** @var $urlRewrite \Magento\UrlRewrite\Model\UrlRewrite */
         $urlRewrite = $this->_rewriteFactory->create();
         $urlRewrite->rewrite($request);
         \Magento\Framework\Profiler::stop('db_url_rewrite');
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:RewriteService.php

示例8: query

 /**
  * @SuppressWarnings(PHPMD.StaticAccess)
  *
  * {@inheritdoc}
  */
 public function query(RequestInterface $request)
 {
     \Magento\Framework\Profiler::start('ES:Execute Search Query');
     try {
         $searchResponse = $this->doSearch($request);
     } catch (\Exception $e) {
         $searchResponse = [];
         $this->logger->error($e->getMessage());
     }
     \Magento\Framework\Profiler::stop('ES:Execute Search Query');
     return $this->responseFactory->create(['searchResponse' => $searchResponse]);
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:17,代码来源:Adapter.php

示例9: dispatch

 /**
  * Perform action and generate response
  *
  * @param RequestInterface $request
  * @return ResponseInterface|\Magento\Framework\Controller\ResultInterface
  * @throws \LogicException
  */
 public function dispatch(RequestInterface $request)
 {
     \Magento\Framework\Profiler::start('routers_match');
     $routingCycleCounter = 0;
     $result = null;
     while (!$request->isDispatched() && $routingCycleCounter++ < 100) {
         $result = $this->processRequest($request);
     }
     \Magento\Framework\Profiler::stop('routers_match');
     if ($routingCycleCounter > 100) {
         throw new \LogicException('Front controller reached 100 router match iterations');
     }
     return $result;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:21,代码来源:FrontController.php

示例10: dispatch

 public function dispatch($eventName, array $data = [])
 {
     \Magento\Framework\Profiler::start('EVENT:' . $eventName, ['group' => 'EVENT', 'name' => $eventName]);
     foreach ($this->_eventConfig->getObservers($eventName) as $observerConfig) {
         $event = new \Magento\Framework\Event($data);
         $event->setName($eventName);
         $wrapper = new \Magento\Framework\Event\Observer();
         $wrapper->setData(array_merge(['event' => $event], $data));
         \Magento\Framework\Profiler::start('OBSERVER:' . $observerConfig['name']);
         $this->_invoker->dispatch($observerConfig, $wrapper);
         $observerConfig['method'] = 'execute';
         $this->_devHelper->setObserverDetails($observerConfig, $eventName);
         \Magento\Framework\Profiler::stop('OBSERVER:' . $observerConfig['name']);
     }
     \Magento\Framework\Profiler::stop('EVENT:' . $eventName);
 }
开发者ID:dineshmalekar,项目名称:Magento2-Developer-Debug-Tool,代码行数:16,代码来源:Manager.php

示例11: dispatch

 /**
  * Dispatches an event to observer's callback
  *
  * @param Event $event
  * @return $this
  */
 public function dispatch(Event $event)
 {
     if (!$this->isValidFor($event)) {
         return $this;
     }
     $callback = $this->getCallback();
     $this->setEvent($event);
     $_profilerKey = 'OBSERVER: ';
     if (is_object($callback[0])) {
         $_profilerKey .= get_class($callback[0]);
     } else {
         $_profilerKey .= (string) $callback[0];
     }
     $_profilerKey .= ' -> ' . $callback[1];
     \Magento\Framework\Profiler::start($_profilerKey);
     call_user_func($callback, $this);
     \Magento\Framework\Profiler::stop($_profilerKey);
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:25,代码来源:Observer.php

示例12: execute

 /**
  * Reindex all data what process is responsible
  *
  * @return void
  */
 public function execute()
 {
     /** @var $process \Magento\Index\Model\Process */
     $process = $this->_initProcess();
     if ($process) {
         try {
             \Magento\Framework\Profiler::start('__INDEX_PROCESS_REINDEX_ALL__');
             $process->reindexEverything();
             \Magento\Framework\Profiler::stop('__INDEX_PROCESS_REINDEX_ALL__');
             $this->messageManager->addSuccess(__('%1 index was rebuilt.', $process->getIndexer()->getName()));
         } catch (\Magento\Framework\Model\Exception $e) {
             $this->messageManager->addError($e->getMessage());
         } catch (\Exception $e) {
             $this->messageManager->addException($e, __('There was a problem with reindexing process.'));
         }
     } else {
         $this->messageManager->addError(__('Cannot initialize the indexer process.'));
     }
     $this->_redirect('adminhtml/*/list');
 }
开发者ID:aiesh,项目名称:magento2,代码行数:25,代码来源:ReindexProcess.php

示例13: getCurrency

 /**
  * @inheritdoc
  */
 public function getCurrency($currency)
 {
     \Magento\Framework\Profiler::start('locale/currency');
     if (!isset(self::$_currencyCache[$this->_localeResolver->getLocale()][$currency])) {
         $options = [];
         try {
             $currencyObject = $this->_currencyFactory->create(['options' => $currency, 'locale' => $this->_localeResolver->getLocale()]);
         } catch (\Exception $e) {
             $currencyObject = $this->_currencyFactory->create(['options' => $this->getDefaultCurrency(), 'locale' => $this->_localeResolver->getLocale()]);
             $options[self::CURRENCY_OPTION_NAME] = $currency;
             $options[self::CURRENCY_OPTION_CURRENCY] = $currency;
             $options[self::CURRENCY_OPTION_SYMBOL] = $currency;
         }
         $options = new \Magento\Framework\Object($options);
         $this->_eventManager->dispatch('currency_display_options_forming', ['currency_options' => $options, 'base_code' => $currency]);
         $currencyObject->setFormat($options->toArray());
         self::$_currencyCache[$this->_localeResolver->getLocale()][$currency] = $currencyObject;
     }
     \Magento\Framework\Profiler::stop('locale/currency');
     return self::$_currencyCache[$this->_localeResolver->getLocale()][$currency];
 }
开发者ID:nja78,项目名称:magento2,代码行数:24,代码来源:Currency.php

示例14: _toHtml

 /**
  * Prepare html output
  *
  * @return string
  */
 protected function _toHtml()
 {
     $storeId = $this->getAnyStoreView()->getId();
     /** @var $template \Magento\Email\Model\Template */
     $template = $this->_emailFactory->create();
     if ($id = (int) $this->getRequest()->getParam('id')) {
         $template->load($id);
     } else {
         $template->setTemplateType($this->getRequest()->getParam('type'));
         $template->setTemplateText($this->getRequest()->getParam('text'));
         $template->setTemplateStyles($this->getRequest()->getParam('styles'));
     }
     $template->setTemplateText($this->_maliciousCode->filter($template->getTemplateText()));
     \Magento\Framework\Profiler::start($this->profilerName);
     $template->emulateDesign($storeId);
     $templateProcessed = $this->_appState->emulateAreaCode(\Magento\Email\Model\AbstractTemplate::DEFAULT_DESIGN_AREA, [$template, 'getProcessedTemplate']);
     $template->revertDesign();
     if ($template->isPlain()) {
         $templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
     }
     \Magento\Framework\Profiler::stop($this->profilerName);
     return $templateProcessed;
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:28,代码来源:Preview.php

示例15: execute

 /**
  * Shopping cart display action
  *
  * @return void
  */
 public function execute()
 {
     if ($this->cart->getQuote()->getItemsCount()) {
         $this->cart->init();
         $this->cart->save();
         if (!$this->cart->getQuote()->validateMinimumAmount()) {
             $currencyCode = $this->_objectManager->get('Magento\\Framework\\StoreManagerInterface')->getStore()->getCurrentCurrencyCode();
             $minimumAmount = $this->_objectManager->get('Magento\\Framework\\Locale\\CurrencyInterface')->getCurrency($currencyCode)->toCurrency($this->_scopeConfig->getValue('sales/minimum_order/amount', \Magento\Store\Model\ScopeInterface::SCOPE_STORE));
             $warning = $this->_scopeConfig->getValue('sales/minimum_order/description', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) ? $this->_scopeConfig->getValue('sales/minimum_order/description', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) : __('Minimum order amount is %1', $minimumAmount);
             $this->messageManager->addNotice($warning);
         }
     }
     // Compose array of messages to add
     $messages = array();
     /** @var \Magento\Framework\Message\MessageInterface $message  */
     foreach ($this->cart->getQuote()->getMessages() as $message) {
         if ($message) {
             // Escape HTML entities in quote message to prevent XSS
             $message->setText($this->_objectManager->get('Magento\\Framework\\Escaper')->escapeHtml($message->getText()));
             $messages[] = $message;
         }
     }
     $this->messageManager->addUniqueMessages($messages);
     /**
      * if customer enteres shopping cart we should mark quote
      * as modified bc he can has checkout page in another window.
      */
     $this->_checkoutSession->setCartWasUpdated(true);
     \Magento\Framework\Profiler::start(__METHOD__ . 'cart_display');
     $this->_view->loadLayout();
     $layout = $this->_view->getLayout();
     $layout->initMessages();
     $layout->getBlock('head')->setTitle(__('Shopping Cart'));
     $this->_view->renderLayout();
     \Magento\Framework\Profiler::stop(__METHOD__ . 'cart_display');
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:41,代码来源:Index.php


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