本文整理汇总了PHP中UTIL_Profiler类的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_Profiler类的具体用法?PHP UTIL_Profiler怎么用?PHP UTIL_Profiler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UTIL_Profiler类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: render
/**
* Returns rendered markup.
*
* @return string
*/
public function render()
{
if (defined("OW_PROFILER_ENABLE") && OW_PROFILER_ENABLE) {
$this->assign('queryLog', OW::getDbo()->getQueryLog());
$this->assign('queryCount', OW::getDbo()->getQueryCount());
$this->assign('queryExecutionTime', OW::getDbo()->getTotalQueryExecTime());
$this->assign('pageTime', UTIL_Profiler::getInstance()->getResult());
}
return $this->assignedVars;
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:15,代码来源:api_action_controller.php
示例3: OW_Event
@(include OW_DIR_ROOT . 'ow_install' . DS . 'install.php');
OW::getSession()->start();
$application = OW::getApplication();
if (OW_PROFILER_ENABLE || OW_DEV_MODE) {
UTIL_Profiler::getInstance()->mark('before_app_init');
}
$application->init();
if (OW_PROFILER_ENABLE || OW_DEV_MODE) {
UTIL_Profiler::getInstance()->mark('after_app_init');
}
$event = new OW_Event(OW_EventManager::ON_APPLICATION_INIT);
OW::getEventManager()->trigger($event);
$application->route();
$event = new OW_Event(OW_EventManager::ON_AFTER_ROUTE);
if (OW_PROFILER_ENABLE || OW_DEV_MODE) {
UTIL_Profiler::getInstance()->mark('after_route');
}
OW::getEventManager()->trigger($event);
//$application->handleRequest();
//
//if (OW_PROFILER_ENABLE || OW_DEV_MODE) {
// UTIL_Profiler::getInstance()->mark('after_controller_call');
//}
$event = new OW_Event(OW_EventManager::ON_AFTER_REQUEST_HANDLE);
OW::getEventManager()->trigger($event);
//$application->finalize();
/**
* SkadateX intialization END
*/
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
开发者ID:bhushansonar,项目名称:hammu,代码行数:31,代码来源:index_4_7_2015.php
示例4: define
define("HAMMU_DB_PAYMENT_TYPE_KEY", "field_2de34e86b2ea038c86f2b4b5be00811e");
define("HAMMU_DB_IM_USING_HAMMU_AS_KEY", "field_8eb4e427b80ac66d870fc0a5a0cc22ba");
define("HAMMU_DB_PREFRENCES_KEY", "field_f2d8bb949d7d74a70bcb2003abc5b436");
define("HAMMU_DB_PREFRENCES_KEY", "field_f2d8bb949d7d74a70bcb2003abc5b436");
define("HAMMU_DB_SERVICES_KEY", "field_f92bbdb57510b86ba6c506c487be3aa1");
define("HAMMU_DB_MOBILE_NUMBER_KEY", "field_391797ad0e06d17d5b5cec0e48def7c2");
mb_internal_encoding('UTF-8');
if (OW_DEBUG_MODE) {
ob_start();
}
spl_autoload_register(array('OW_Autoload', 'autoload'));
// adding standard package pointers
$autoloader = OW::getAutoloader();
$autoloader->addPackagePointer('OW', OW_DIR_CORE);
$autoloader->addPackagePointer('INC', OW_DIR_INC);
$autoloader->addPackagePointer('UTIL', OW_DIR_UTIL);
$autoloader->addPackagePointer('BOL', OW_DIR_SYSTEM_PLUGIN . 'base' . DS . 'bol');
// Force autoload of classes without package pointer
$classesToAutoload = array('Form' => OW_DIR_CORE . 'form.php', 'TextField' => OW_DIR_CORE . 'form_element.php', 'HiddenField' => OW_DIR_CORE . 'form_element.php', 'FormElement' => OW_DIR_CORE . 'form_element.php', 'RequiredValidator' => OW_DIR_CORE . 'validator.php', 'StringValidator' => OW_DIR_CORE . 'validator.php', 'RegExpValidator' => OW_DIR_CORE . 'validator.php', 'EmailValidator' => OW_DIR_CORE . 'validator.php', 'UrlValidator' => OW_DIR_CORE . 'validator.php', 'AlphaNumericValidator' => OW_DIR_CORE . 'validator.php', 'IntValidator' => OW_DIR_CORE . 'validator.php', 'FloatValidator' => OW_DIR_CORE . 'validator.php', 'DateValidator' => OW_DIR_CORE . 'validator.php', 'CaptchaValidator' => OW_DIR_CORE . 'validator.php', 'RadioField' => OW_DIR_CORE . 'form_element.php', 'CheckboxField' => OW_DIR_CORE . 'form_element.php', 'Selectbox' => OW_DIR_CORE . 'form_element.php', 'CheckboxGroup' => OW_DIR_CORE . 'form_element.php', 'RadioField' => OW_DIR_CORE . 'form_element.php', 'PasswordField' => OW_DIR_CORE . 'form_element.php', 'Submit' => OW_DIR_CORE . 'form_element.php', 'Button' => OW_DIR_CORE . 'form_element.php', 'Textarea' => OW_DIR_CORE . 'form_element.php', 'FileField' => OW_DIR_CORE . 'form_element.php', 'TagsField' => OW_DIR_CORE . 'form_element.php', 'SuggestField' => OW_DIR_CORE . 'form_element.php', 'MultiFileField' => OW_DIR_CORE . 'form_element.php', 'Multiselect' => OW_DIR_CORE . 'form_element.php', 'CaptchaField' => OW_DIR_CORE . 'form_element.php', 'InvitationFormElement' => OW_DIR_CORE . 'form_element.php', 'Range' => OW_DIR_CORE . 'form_element.php');
OW::getAutoloader()->addClassArray($classesToAutoload);
if (defined("OW_URL_HOME")) {
OW::getRouter()->setBaseUrl(OW_URL_HOME);
}
if (OW_PROFILER_ENABLE) {
UTIL_Profiler::getInstance();
}
require_once OW_DIR_SYSTEM_PLUGIN . 'base' . DS . 'classes' . DS . 'file_log_writer.php';
require_once OW_DIR_SYSTEM_PLUGIN . 'base' . DS . 'classes' . DS . 'db_log_writer.php';
require_once OW_DIR_SYSTEM_PLUGIN . 'base' . DS . 'classes' . DS . 'err_output.php';
$errorManager = OW_ErrorManager::getInstance(OW_DEBUG_MODE);
$errorManager->setErrorOutput(new BASE_CLASS_ErrOutput());
开发者ID:hardikamutech,项目名称:hammu,代码行数:31,代码来源:init_1_6_2015.php
示例5: OW_Event
$errorManager->setLogger($logger);
}
@(include OW_DIR_ROOT . 'ow_install' . DS . 'install.php');
OW::getSession()->start();
$application = OW::getApplication();
if (OW_PROFILER_ENABLE || OW_DEV_MODE) {
UTIL_Profiler::getInstance()->mark('before_app_init');
}
$application->init();
if (OW_PROFILER_ENABLE || OW_DEV_MODE) {
UTIL_Profiler::getInstance()->mark('after_app_init');
}
$event = new OW_Event(OW_EventManager::ON_APPLICATION_INIT);
OW::getEventManager()->trigger($event);
$application->route();
$event = new OW_Event(OW_EventManager::ON_AFTER_ROUTE);
if (OW_PROFILER_ENABLE || OW_DEV_MODE) {
UTIL_Profiler::getInstance()->mark('after_route');
}
OW::getEventManager()->trigger($event);
$application->handleRequest();
if (OW_PROFILER_ENABLE || OW_DEV_MODE) {
UTIL_Profiler::getInstance()->mark('after_controller_call');
}
$event = new OW_Event(OW_EventManager::ON_AFTER_REQUEST_HANDLE);
OW::getEventManager()->trigger($event);
$application->finalize();
if (OW_PROFILER_ENABLE || OW_DEV_MODE) {
UTIL_Profiler::getInstance()->mark('after_finalize');
}
$application->returnResponse();
开发者ID:ecki,项目名称:oxwall,代码行数:31,代码来源:index.php
示例6: base_dev_tool
function base_dev_tool(BASE_CLASS_EventCollector $event)
{
$viewRenderer = OW_ViewRenderer::getInstance();
$prevVars = $viewRenderer->getAllAssignedVars();
$viewRenderer->assignVar('oxwall', (array) simplexml_load_file(OW_DIR_ROOT . 'ow_version.xml'));
$requestHandlerData = OW::getRequestHandler()->getDispatchAttributes();
try {
$ctrlPath = OW::getAutoloader()->getClassPath($requestHandlerData['controller']);
} catch (Exception $e) {
$ctrlPath = 'not_found';
}
$requestHandlerData['ctrlPath'] = $ctrlPath;
$requestHandlerData['paramsExp'] = var_export(empty($requestHandlerData['params']) ? array() : $requestHandlerData['params'], true);
$viewRenderer->assignVar('requestHandler', $requestHandlerData);
$viewRenderer->assignVar('profiler', UTIL_Profiler::getInstance()->getResult());
$viewRenderer->assignVar('memoryUsage', function_exists('memory_get_peak_usage') ? sprintf('%0.3f', memory_get_peak_usage(true) / 1048576) : 'No info');
if (!OW_DEV_MODE || true) {
//TODO remove hardcode
$viewRenderer->assignVar('clrBtnUrl', OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('BASE_CTRL_Base', 'turnDevModeOn'), array('back-uri' => urlencode(OW::getRouter()->getUri()))));
}
$rndItems = OW_Renderable::getRenderedClasses();
$rndArray = array('mp' => array(), 'cmp' => array(), 'ctrl' => array());
foreach ($rndItems as $key => $item) {
try {
$src = OW::getAutoloader()->getClassPath($key);
} catch (Exception $e) {
$src = 'not_found';
}
$addItem = array('class' => $key, 'src' => $src, 'tpl' => $item);
if (strstr($key, 'OW_MasterPage')) {
$rndArray['mp'] = $addItem;
} else {
if (strstr($key, '_CTRL_')) {
$rndArray['ctrl'] = $addItem;
} else {
$rndArray['cmp'][] = $addItem;
}
}
}
$viewRenderer->assignVar('renderedItems', array('items' => $rndArray, 'count' => count(OW_Renderable::getRenderedClasses()) - 2));
$queryLog = OW::getDbo()->getQueryLog();
foreach ($queryLog as $key => $query) {
if (isset($_GET['pr_query_log_filter']) && strlen($_GET['pr_query_log_filter']) > 3) {
if (!strstr($query['query'], $_GET['pr_query_log_filter'])) {
unset($queryLog[$key]);
continue;
}
}
if ($query['params'] && is_array($query['params'])) {
$queryLog[$key]['params'] = var_export($query['params'], true);
}
}
$viewRenderer->assignVar('database', array('qet' => OW::getDbo()->getTotalQueryExecTime(), 'ql' => $queryLog, 'qc' => count($queryLog)));
//events
$eventsData = OW::getEventManager()->getLog();
$eventsDataToAssign = array('bind' => array(), 'calls' => array());
foreach ($eventsData['bind'] as $eventName => $listeners) {
$listenersList = array();
foreach ($listeners as $priority) {
foreach ($priority as $listener) {
if (is_array($listener)) {
if (is_object($listener[0])) {
$listener = get_class($listener[0]) . ' -> ' . $listener[1];
} else {
$listener = $listener[0] . ' :: ' . $listener[1];
}
}
$listenersList[] = $listener;
}
}
$eventsDataToAssign['bind'][] = array('name' => $eventName, 'listeners' => $listenersList);
}
foreach ($eventsData['call'] as $eventItem) {
$listenersList = array();
foreach ($eventItem['listeners'] as $priority) {
foreach ($priority as $listener) {
if (is_array($listener)) {
if (is_object($listener[0])) {
$listener = get_class($listener[0]) . ' -> ' . $listener[1];
} else {
$listener = $listener[0] . ' :: ' . $listener[1];
}
}
$listenersList[] = $listener;
}
}
$eventsDataToAssign['call'][] = array('type' => $eventItem['type'], 'name' => $eventItem['event']->getName(), 'listeners' => $listenersList, 'params' => var_export($eventItem['event']->getParams(), true), 'start' => sprintf('%.3f', $eventItem['start']), 'exec' => sprintf('%.3f', $eventItem['exec']));
}
$eventsDataToAssign['bindsCount'] = count($eventsDataToAssign['bind']);
$eventsDataToAssign['callsCount'] = count($eventsDataToAssign['call']);
$viewRenderer->assignVar('events', $eventsDataToAssign);
$output = $viewRenderer->renderTemplate(OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'dev_tools_tpl.html');
$viewRenderer->clearAssignedVars();
$viewRenderer->assignVars($prevVars);
$event->add($output);
}
开发者ID:vazahat,项目名称:dudex,代码行数:96,代码来源:application.php
示例7: onAppendMarkup
/**
* The method collects all the developer info during the page handling.
*
* @param BASE_CLASS_EventCollector $event
*/
public function onAppendMarkup(BASE_CLASS_EventCollector $event)
{
$viewRenderer = OW_ViewRenderer::getInstance();
$viewRenderer->assignVar("oxwall", BOL_StorageService::getInstance()->getPlatformXmlInfo());
$view = new OW_View();
$view->setTemplate(OW::getPluginManager()->getPlugin("base")->getCmpViewDir() . "dev_tools_tpl.html");
// get current request attributes
$requestHandlerData = OW::getRequestHandler()->getDispatchAttributes();
try {
$ctrlPath = OW::getAutoloader()->getClassPath($requestHandlerData["controller"]);
} catch (Exception $e) {
$ctrlPath = "not_found";
}
$requestHandlerData["ctrlPath"] = $ctrlPath;
$requestHandlerData["paramsExp"] = var_export(empty($requestHandlerData["params"]) ? array() : $requestHandlerData["params"], true);
$view->assign("requestHandler", $requestHandlerData);
// get current request memory usage
$memoryUsage = "No info";
if (function_exists("memory_get_peak_usage")) {
$memoryUsage = UTIL_File::convertBytesToHumanReadable(memory_get_peak_usage(true));
}
$view->assign("memoryUsage", $memoryUsage);
// get default profiler data
$view->assign("profiler", UTIL_Profiler::getInstance()->getResult());
// rendered view data
$view->assign("renderedItems", $this->getViewInfo(OW_View::getDevInfo()));
// sql queries data
$filter = !empty($_GET["pr_query_log_filter"]) ? trim($_GET["pr_query_log_filter"]) : null;
$view->assign("database", $this->getSqlInfo(OW::getDbo()->getQueryLog(), OW::getDbo()->getTotalQueryExecTime(), $filter));
// events data
$view->assign("events", $this->getEventInfo(OW::getEventManager()->getLog()));
$event->add($view->render());
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:38,代码来源:developer_tools.php
示例8: getInstance
/**
* Returns "single-tone" instance of class for every $key
*
* @param string $key #Profiler object identifier#
* @return UTIL_Profiler
*/
public static function getInstance($key = '_ow_')
{
if (self::$classInstances === null) {
self::$classInstances = array();
}
if (!isset(self::$classInstances[$key])) {
self::$classInstances[$key] = new self($key);
}
return self::$classInstances[$key];
}
开发者ID:vazahat,项目名称:dudex,代码行数:16,代码来源:profiler.php
示例9: respond
/**
* Sends generated response
*
*/
public function respond()
{
$event = new OW_Event(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER);
OW::getEventManager()->trigger($event);
if ($this->document !== null) {
$renderedMarkup = $this->document->render();
$event = new BASE_CLASS_EventCollector('base.append_markup');
OW::getEventManager()->trigger($event);
$data = $event->getData();
$this->markup = str_replace(OW_Document::APPEND_PLACEHOLDER, PHP_EOL . implode(PHP_EOL, $data), $renderedMarkup);
}
$event = new OW_Event(OW_EventManager::ON_AFTER_DOCUMENT_RENDER);
OW::getEventManager()->trigger($event);
$this->sendHeaders();
if (OW::getRequest()->isAjax()) {
exit;
}
if (OW_PROFILER_ENABLE || OW_DEV_MODE) {
UTIL_Profiler::getInstance()->mark('final');
}
if (OW_DEBUG_MODE) {
echo ob_get_clean();
}
echo $this->markup;
$event = new OW_Event('core.exit');
OW::getEventManager()->trigger($event);
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:31,代码来源:response.php
示例10: startSitemapGenerator
public function startSitemapGenerator()
{
if (!OW::getConfig()->getValue('oaseo', 'sitemap_init')) {
OW::getConfig()->saveConfig('oaseo', 'sitemap_init', 1);
}
$prof = UTIL_Profiler::getInstance('oaseo_sitemap');
if (OW::getConfig()->getValue('oaseo', 'update_info')) {
OW::getConfig()->saveConfig('oaseo', 'update_info', 0);
$this->sitemapItemDao->clearTable();
$this->sitemapPageDao->clearTable();
$this->sitemapPageItemDao->clearTable();
$this->addUrlToList(UTIL_String::removeFirstAndLastSlashes(OW_URL_HOME));
}
if ($this->getNextUrlToProcess() == null) {
return;
}
while ($prof->getTotalTime() < $this->configs[self::CNF_CRAWL_TIME_LIMIT]) {
$url = $this->getNextUrlToProcess();
//
// if ( $url == null )
// {
// // need to complete site generation + generate sitemaps in configs
// OW::getConfig()->saveConfig('oaseo', 'update_maps', 1);
// break;
// }
$pageDto = $this->sitemapPageDao->findByUrl($url, 0);
if ($pageDto != null) {
$pageDto->setStatus(1);
$pageDto->setProcessTs(time());
$this->sitemapPageDao->save($pageDto);
if ($this->isBroken($url)) {
$pageDto->setBroken(true);
$this->sitemapPageDao->save($pageDto);
continue;
}
}
// TODO need to check if response is ok
$content = file_get_contents($url);
if (!$content) {
continue;
$this->sitemapPageDao->deleteById($pageDto->getId());
}
$data = $this->processContent($content);
$urlHome = UTIL_String::removeFirstAndLastSlashes(OW_URL_HOME);
//add meta info to the page entry
$pageDto = $this->sitemapPageDao->findByUrl($url);
$pageDto->setMeta(json_encode($data['meta']));
$pageDto->setTitle($data['title']);
$this->sitemapPageDao->save($pageDto);
foreach ($data['foundLinks'] as $link) {
$pageItem = new OASEO_BOL_SitemapPageItem();
if (mb_strstr($link, $urlHome)) {
$addedItem = $this->addUrlToList($link);
if ($addedItem === null) {
continue;
}
$pageItem->setType(OASEO_BOL_SitemapPageItemDao::TYPE_VALUE_PAGE);
} else {
if (mb_strstr($link, 'http://') || mb_strstr($link, 'www')) {
$addedItem = $this->addExtUrl($link);
if ($addedItem === null) {
continue;
}
$pageItem->setType(OASEO_BOL_SitemapPageItemDao::TYPE_VALUE_ITEM);
} else {
continue;
}
}
$pageItem->setPageId($pageDto->getId());
$pageItem->setItemId($addedItem->getId());
$this->sitemapPageItemDao->save($pageItem);
}
foreach ($data['foundImages'] as $image) {
$pageItem = new OASEO_BOL_SitemapPageItem();
$image = $this->addImage($image);
$pageItem->setPageId($pageDto->getId());
$pageItem->setItemId($image->getId());
$pageItem->setType(OASEO_BOL_SitemapPageItemDao::TYPE_VALUE_ITEM);
$this->sitemapPageItemDao->save($pageItem);
}
if ($this->getNextUrlToProcess() == null) {
// need to complete site generation + generate sitemaps in configs
OW::getConfig()->saveConfig('oaseo', 'update_maps', 1);
break;
}
}
}
开发者ID:vazahat,项目名称:dudex,代码行数:87,代码来源:service.php
示例11: profiler_mark
function profiler_mark($markKey = null)
{
UTIL_Profiler::getInstance()->mark($markKey);
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:4,代码来源:function.php
示例12: 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
注:本文中的UTIL_Profiler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论