本文整理汇总了PHP中Varien_Profiler::checkThresholds方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Profiler::checkThresholds方法的具体用法?PHP Varien_Profiler::checkThresholds怎么用?PHP Varien_Profiler::checkThresholds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Profiler
的用法示例。
在下文中一共展示了Varien_Profiler::checkThresholds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: persistProfile
/**
* Persist profile
*
* This method is called from the controller_front_send_response_after event
*
* @author Fabrizio Branca
* @since 2014-02-01
*
* @param Varien_Event_Observer $event
*/
public function persistProfile(Varien_Event_Observer $event)
{
if (!method_exists('Varien_Profiler', 'isEnabled')) {
Mage::log('Looks like the wrong Profiler class is being loaded at this point.');
return;
}
if (Varien_Profiler::isEnabled() && Varien_Profiler::checkThresholds()) {
$run = Mage::getModel('aoe_profiler/run');
/* @var $run Aoe_Profiler_Model_Run */
$run->loadStackLogFromProfiler();
$run->populateMetadata();
try {
$run->save();
} catch (Exception $e) {
Mage::log('Error while saving Aoe_Profiler data: ' . $e->getMessage());
}
}
}
示例2: checkMemoryThresholdEnoughMemory
/**
* @test
*/
public function checkMemoryThresholdEnoughMemory()
{
$mockConfig = new stdClass();
$mockConfig->trigger = 'always';
$mockConfig->enableFilters = true;
$mockConfig->filters = new stdClass();
$mockConfig->filters->sampling = 100;
$mockConfig->filters->timeThreshold = 0;
$mockConfig->filters->memoryThreshold = 5 * 1024 * 1024;
// 5MB
$mockConfig->filters->requestUriWhiteList = '';
$mockConfig->filters->requestUriBlackList = '';
$mockConfig->captureModelInfo = false;
$mockConfig->captureBacktraces = false;
Varien_Profiler::reInit();
Varien_Profiler::setConfiguration($mockConfig);
Varien_Profiler::start('TEST');
$memory = array();
for ($i = 0; $i < 6 * 1024; $i++) {
$memory[] = str_repeat('M', 1024);
}
Varien_Profiler::stop('TEST');
$this->assertTrue(Varien_Profiler::checkThresholds());
}