本文整理匯總了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());
}