summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2011-09-27 17:11:21 +0000
committerUrban Müller2011-09-27 17:11:21 +0000
commita937111319299a5af1390496329410d89fcb6ef8 (patch)
tree06f3c45156336865665eefbb532d4fb13b51c0a1
parentdd3bb8dc7b173049f09969265e100e2e9f430946 (diff)
downloaditools-a937111319299a5af1390496329410d89fcb6ef8.tar.gz
itools-a937111319299a5af1390496329410d89fcb6ef8.tar.bz2
itools-a937111319299a5af1390496329410d89fcb6ef8.zip
speedup and lower mem usage for traces
-rw-r--r--it_debug.class25
1 files changed, 10 insertions, 15 deletions
diff --git a/it_debug.class b/it_debug.class
index 0b14cc7..3c05992 100644
--- a/it_debug.class
+++ b/it_debug.class
@@ -59,7 +59,7 @@ function debug($text, $level = 0)
function srcline($stackoffs = 0)
{
- $stack = debug_backtrace();
+ $stack = debug_backtrace(@constant('DEBUG_BACKTRACE_IGNORE_ARGS'));
$line = $stack[1 + $stackoffs]['line'];
$file = $stack[1 + $stackoffs]['file'];
@@ -158,7 +158,7 @@ function dump($args)
}
if ($GLOBALS['debug_indent'])
- $r = str_repeat(" ", count(debug_backtrace())-3) . $r;
+ $r = str_repeat(" ", count(debug_backtrace(@constant('DEBUG_BACKTRACE_IGNORE_ARGS')))-3) . $r;
# not it_html::Q(); we dont wanna load it_html in ultraclassloader debugging
$title = htmlspecialchars(it_debug::backtrace(array('skiplevels' => 1)));
@@ -182,23 +182,18 @@ function backtrace($p = array())
$p += array('levels' => 0, 'skiplevels'=> 0, 'skipfiles' => "###");
- if (function_exists('memory_get_usage') && (memory_get_usage() > 50000000))
- $result = array("[mem usage too high]");
- else
+ foreach (array_slice(debug_backtrace(@constant('DEBUG_BACKTRACE_IGNORE_ARGS')), $p['skiplevels'] + 1) as $call)
{
- foreach (array_slice(debug_backtrace(), $p['skiplevels'] + 1) as $call)
+ if (($fn = $call['file']) && !it::match($p['skipfiles'], $call['file']))
{
- if (($fn = $call['file']) && !it::match($p['skipfiles'], $call['file']))
- {
- if (!it::match('\.class', $call['file']) && file_get_contents($call['file'], null, null, 0, 2) == "#!")
- $call['line']++; # fix bug in php error line reporting
+ if (!it::match('\.class', $call['file']) && file_get_contents($call['file'], null, null, 0, 2) == "#!")
+ $call['line']++; # fix bug in php error line reporting
- $fn = (it::match('auto_prepend', $fn) ? basename(dirname(dirname($fn))) . "/" : "") . basename($fn);
- $result[] = $fn . ":" . $call['line'];
+ $fn = (it::match('auto_prepend', $fn) ? basename(dirname(dirname($fn))) . "/" : "") . basename($fn);
+ $result[] = $fn . ":" . $call['line'];
- if (--$p['levels'] == 0)
- break;
- }
+ if (--$p['levels'] == 0)
+ break;
}
}