本文整理汇总了PHP中Hook::getExecutedModules方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::getExecutedModules方法的具体用法?PHP Hook::getExecutedModules怎么用?PHP Hook::getExecutedModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hook
的用法示例。
在下文中一共展示了Hook::getExecutedModules方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayDebug
public function displayDebug()
{
global $start_time;
$this->display();
$this->_memory['display'] = memory_get_usage();
$this->_mempeak['display'] = memory_get_peak_usage();
$this->_time['display'] = microtime(true);
$memory_peak_usage = memory_get_peak_usage();
$hr = '<hr>';
$totalSize = 0;
foreach (get_included_files() as $file) {
$totalSize += filesize($file);
}
$totalQueryTime = 0;
foreach (Db::getInstance()->queries as $data) {
$totalQueryTime += $data['time'];
}
$executedModules = Hook::getExecutedModules();
$hooktime = Hook::getHookTime();
arsort($hooktime);
$totalHookTime = 0;
foreach ($hooktime as $time) {
$totalHookTime += $time;
}
$hookMemoryUsage = Hook::getHookMemoryUsage();
arsort($hookMemoryUsage);
$totalHookMemoryUsage = 0;
foreach ($hookMemoryUsage as $usage) {
$totalHookMemoryUsage += $usage;
}
$globalSize = array();
$totalGlobalSize = 0;
foreach ($GLOBALS as $key => $value) {
if ($key != 'GLOBALS') {
$totalGlobalSize += $size = $this->sizeofvar($value);
if ($size > 1024) {
$globalSize[$key] = round($size / 1024);
}
}
}
arsort($globalSize);
$cache = Cache::retrieveAll();
$totalCacheSize = $this->sizeofvar($cache);
echo '
<style>
#ps_profiling{
padding: 20px;
}
.ps_back-office.page-sidebar #ps_profiling{
margin-left: 210px;
}
.ps_back-office.page-sidebar-closed #ps_profiling{
margin-left: 50px;
}
.ps_back-office #ps_profiling{
clear: both;
padding: 10px;
margin-bottom: 50px;
}
#ps_profiling *{
box-sizing:border-box;
-moz-box-sizing:border-box;
color: #888;
}
#ps_profiling .ps_profiling_title{
font-size: 20px;
display: inline-block;
padding-bottom: 15px;
}
#ps_profiling ul{
margin: 0;
padding: 0;
list-style: none;
}
#ps_profiling hr{
margin: 5px 0;
padding: 0;
border: none;
border-bottom: solid 1px #ccc;
}
#ps_profiling td pre{
padding: 6px;
margin-right: 10px;
border-radius: 5px;
overflow: auto;
display: block;
color: #777;
font-size: 12px;
line-height: 1.42857;
word-break: break-all;
word-wrap: break-word;
background-color: whitesmoke;
border: 1px solid #cccccc;
max-width: 960px;
}
#ps_profiling td .qbt{
max-height: 140px;
overflow: auto;
}
#ps_profiling table{
//.........这里部分代码省略.........
示例2: displayDebug
public function displayDebug()
{
global $start_time;
$this->display();
$this->_memory['display'] = memory_get_usage();
$this->_mempeak['display'] = memory_get_peak_usage();
$this->_time['display'] = microtime(true);
if (!$this->ini_get_display_errors()) {
return;
}
$memory_peak_usage = memory_get_peak_usage();
$hr = '<hr style="color:#F5F5F5;margin:2px" />';
$totalSize = 0;
foreach (get_included_files() as $file) {
$totalSize += filesize($file);
}
$totalQueryTime = 0;
foreach (Db::getInstance()->queries as $data) {
$totalQueryTime += $data['time'];
}
$executedModules = Hook::getExecutedModules();
$hooktime = Hook::getHookTime();
arsort($hooktime);
$totalHookTime = 0;
foreach ($hooktime as $time) {
$totalHookTime += $time;
}
$hookMemoryUsage = Hook::getHookMemoryUsage();
arsort($hookMemoryUsage);
$totalHookMemoryUsage = 0;
foreach ($hookMemoryUsage as $usage) {
$totalHookMemoryUsage += $usage;
}
$globalSize = array();
$totalGlobalSize = 0;
foreach ($GLOBALS as $key => $value) {
if ($key != 'GLOBALS') {
$totalGlobalSize += $size = $this->sizeofvar($value);
if ($size > 1024) {
$globalSize[$key] = round($size / 1024, 1);
}
}
}
arsort($globalSize);
$cache = Cache::retrieveAll();
$totalCacheSize = $this->sizeofvar($cache);
echo '
<div style="clear:both;height:20px;line-height:20px"> </div>
<div style="margin:50px;background-color:#FFFFFF">
<div class="rte" style="text-align:left;padding:8px;float:left">
<b>Load time</b>: ' . $this->displayLoadTimeColor($this->_time['display'] - $start_time, true) . '';
if (self::$_footer) {
echo '<ul>';
}
$last_time = $start_time;
foreach ($this->_time as $k => $time) {
echo '<li>' . $k . ': ' . $this->displayLoadTimeColor($time - $last_time) . '</li>';
$last_time = $time;
}
echo '</ul>';
echo '</div>
<div class="rte" style="text-align:left;padding:8px;float:left;margin-left:20px">
<b>Hook processing</b>: ' . $this->displayLoadTimeColor($totalHookTime) . ' / ' . $this->displayMemoryColor($totalHookMemoryUsage) . '<br />
' . (int) count($executedModules) . ' methods called in ' . (int) count(array_unique($executedModules)) . ' modules
<ul>';
foreach ($hooktime as $hook => $time) {
echo '<li>' . $hook . ': ' . $this->displayLoadTimeColor($time) . ' / ' . $this->displayMemoryColor($hookMemoryUsage[$hook]) . '</li>';
}
echo '</ul>
</div>
<div class="rte" style="text-align:left;padding:8px;float:left;margin-left:20px">
<b>Memory peak usage</b>: ' . $this->displayPeakMemoryColor($memory_peak_usage);
if (self::$_footer) {
echo '<ul>';
$last_memory = 0;
foreach ($this->_memory as $k => $memory) {
echo '<li>' . $k . ': ' . $this->displayMemoryColor($memory - $last_memory) . ' (' . $this->displayPeakMemoryColor($this->_mempeak[$k]) . ')</li>';
$last_memory = $memory;
}
echo '</ul>';
}
echo '<br /><br />
<b>Total cache size (in Cache class)</b>: ' . $this->displayMemoryColor($totalCacheSize) . '
</div>';
echo '
<div class="rte" style="text-align:left;padding:8px;float:left;margin-left:20px">
<b>DB type</b>: ' . get_class(Db::getInstance()) . '
<br /><b>SQL Queries</b>: ' . $this->displaySQLQueries(count(Db::getInstance()->queries)) . '
<br /><b>Time spent querying</b>: ' . $this->displayLoadTimeColor($totalQueryTime) . '
</div>
<div class="rte" style="text-align:left;padding:8px;float:left;margin-left:20px">
<b>Included files</b>: ' . sizeof(get_included_files()) . '<br />
<b>Size of included files</b>: ' . $this->displayMemoryColor($totalSize) . '
</div>
<div class="rte" style="text-align:left;padding:8px;float:left;margin-left:20px">
<b>Globals (> 1 Ko only): ' . round($totalGlobalSize / 1024) . ' Ko</b>
<ul>';
foreach ($globalSize as $global => $size) {
echo '<li>' . $global . ' ≈ ' . $size . ' Ko</li>';
//.........这里部分代码省略.........