本文整理匯總了PHP中DebugKitDebugger::getMemoryUse方法的典型用法代碼示例。如果您正苦於以下問題:PHP DebugKitDebugger::getMemoryUse方法的具體用法?PHP DebugKitDebugger::getMemoryUse怎麽用?PHP DebugKitDebugger::getMemoryUse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DebugKitDebugger
的用法示例。
在下文中一共展示了DebugKitDebugger::getMemoryUse方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testMemoryUsage
/**
* test memory usage
*
* @return void
**/
function testMemoryUsage()
{
$result = DebugKitDebugger::getMemoryUse();
$this->assertTrue(is_int($result));
$result = DebugKitDebugger::getPeakMemoryUse();
$this->assertTrue(is_int($result));
}
示例2: setMemoryPoint
/**
* Stores a memory point in the internal tracker.
* Takes a optional message name which can be used to identify the memory point.
* If no message is supplied a debug_backtrace will be done to identifty the memory point.
* If you don't have memory_get_xx methods this will not work.
*
* @param string $message Message to identify this memory point.
* @return boolean
**/
function setMemoryPoint($message = null)
{
$memoryUse = DebugKitDebugger::getMemoryUse();
if (!$message) {
$named = false;
$trace = debug_backtrace();
$message = Debugger::trimpath($trace[0]['file']) . ' line ' . $trace[0]['line'];
}
$self =& DebugKitDebugger::getInstance();
if (isset($self->__memoryPoints[$message])) {
$originalMessage = $message;
$i = 1;
while (isset($self->__memoryPoints[$message])) {
$i++;
$message = $originalMessage . ' #' . $i;
}
}
$self->__memoryPoints[$message] = $memoryUse;
return true;
}