本文整理汇总了PHP中Debugger::trimpath方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::trimpath方法的具体用法?PHP Debugger::trimpath怎么用?PHP Debugger::trimpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debugger
的用法示例。
在下文中一共展示了Debugger::trimpath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startTimer
/**
* Start an benchmarking timer.
*
* @param string $name The name of the timer to start.
* @param string $message A message for your timer
* @return bool true
* @static
**/
function startTimer($name = null, $message = null)
{
$start = getMicrotime();
$_this = DebugKitDebugger::getInstance();
if (!$name) {
$named = false;
$calledFrom = debug_backtrace();
$_name = $name = Debugger::trimpath($calledFrom[0]['file']) . ' line ' . $calledFrom[0]['line'];
} else {
$named = true;
}
if (!$message) {
$message = $name;
}
$_name = $name;
$i = 1;
while (isset($_this->__benchmarks[$name])) {
$i++;
$name = $_name . ' #' . $i;
}
if ($i > 1) {
$message .= ' #' . $i;
}
$_this->__benchmarks[$name] = array('start' => $start, 'message' => $message, 'named' => $named);
return true;
}
示例2: start
/**
* Start an benchmarking timer.
*
* @param string $name The name of the timer to start.
* @param string $message A message for your timer
* @return bool Always true
*/
public static function start($name = null, $message = null)
{
$start = microtime(true);
if (!$name) {
$named = false;
$calledFrom = debug_backtrace();
$name = Debugger::trimpath($calledFrom[0]['file']) . ' line ' . $calledFrom[0]['line'];
} else {
$named = true;
}
if (!$message) {
$message = $name;
}
$_name = $name;
$i = 1;
while (isset(self::$_timers[$name])) {
$i++;
$name = $_name . ' #' . $i;
}
if ($i > 1) {
$message .= ' #' . $i;
}
self::$_timers[$name] = array('start' => $start, 'message' => $message, 'named' => $named);
return true;
}
示例3: record
/**
* 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 identify the memory point.
*
* @param string $message Message to identify this memory point.
* @return bool
*/
public static function record($message = null)
{
$memoryUse = self::getCurrent();
if (!$message) {
$trace = debug_backtrace();
$message = Debugger::trimpath($trace[0]['file']) . ' line ' . $trace[0]['line'];
}
if (isset(self::$_points[$message])) {
$originalMessage = $message;
$i = 1;
while (isset(self::$_points[$message])) {
$i++;
$message = $originalMessage . ' #' . $i;
}
}
self::$_points[$message] = $memoryUse;
return true;
}
示例4: 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;
}