當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UTIL_Profiler::reset方法代碼示例

本文整理匯總了PHP中UTIL_Profiler::reset方法的典型用法代碼示例。如果您正苦於以下問題:PHP UTIL_Profiler::reset方法的具體用法?PHP UTIL_Profiler::reset怎麽用?PHP UTIL_Profiler::reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UTIL_Profiler的用法示例。


在下文中一共展示了UTIL_Profiler::reset方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: execute

 /**
  * Returns current PDOStatement
  *
  * @return PDOStatement
  */
 private function execute($sql, array $params = null)
 {
     if ($this->isProfilerEnabled) {
         $this->profiler->reset();
     }
     /* @var $stmt PDOStatement */
     $stmt = $this->connection->prepare($sql);
     if ($params !== null) {
         foreach ($params as $key => $value) {
             $paramType = PDO::PARAM_STR;
             if (is_int($value)) {
                 $paramType = PDO::PARAM_INT;
             } elseif (is_bool($value)) {
                 $paramType = PDO::PARAM_BOOL;
             }
             $stmt->bindValue(is_int($key) ? $key + 1 : $key, $value, $paramType);
         }
     }
     OW::getEventManager()->trigger(new OW_Event("core.sql.exec_query", array("sql" => $sql, "params" => $params)));
     $stmt->execute();
     //TODO setup profiler
     $this->affectedRows = $stmt->rowCount();
     if ($this->isProfilerEnabled) {
         $this->queryExecTime = $this->profiler->getTotalTime();
         $this->totalQueryExecTime += $this->queryExecTime;
         $this->queryCount++;
         $this->queryLog[] = array('query' => $sql, 'execTime' => $this->queryExecTime, 'params' => $params);
     }
     return $stmt;
 }
開發者ID:hardikamutech,項目名稱:hammu,代碼行數:35,代碼來源:database_4_6_2015.php

示例2: call

 /**
  * Calls last event listener and returns it's result value.
  *
  * @param string $eventName
  * @param array $eventParams
  * @return mixed
  */
 public function call($eventName, $eventParams = array())
 {
     $event = new OW_Event($eventName, $eventParams);
     if (!empty($this->listeners[$eventName])) {
         ksort($this->listeners[$event->getName()]);
         // log triggered events for developer mode
         if ($this->devMode) {
             $startTime = UTIL_Profiler::getInstance()->getTotalTime();
             $this->profiler->reset();
             $handlers = reset($this->listeners[$eventName]);
             $result = call_user_func(end($handlers), $event);
             if (!in_array($event->getName(), $this->eventsToSkip) && count($this->eventsLog) < $this->maxItemsInLog) {
                 $this->eventsLog[] = array('type' => 'call', 'start' => $startTime, 'exec' => $this->profiler->getTotalTime(), 'event' => $event, 'listeners' => $this->listeners[$event->getName()]);
             }
         } else {
             $handlers = reset($this->listeners[$eventName]);
             $result = call_user_func(end($handlers), $event);
         }
         return $result;
     } else {
         // log events with no listeners
         $startTime = UTIL_Profiler::getInstance()->getTotalTime();
         if ($this->devMode && !in_array($event->getName(), $this->eventsToSkip) && count($this->eventsLog) < $this->maxItemsInLog) {
             $this->eventsLog[] = array('type' => 'call', 'start' => $startTime, 'event' => $event, 'listeners' => array(), 'exec' => 0);
         }
     }
 }
開發者ID:hardikamutech,項目名稱:hammu,代碼行數:34,代碼來源:event_manager.php


注:本文中的UTIL_Profiler::reset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。