├── trace-own.cache ├── README.markdown ├── xdebug.ini ├── trace-code.php ├── trace.css ├── trace.config.php └── trace.php /trace-own.cache: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | Original code from: http://www.rdlt.com/xdebug-trace-file-parser.html 2 | 3 | Detects all the traces in your xdebug trace directory and offers to look at them in a nice way. 4 | -------------------------------------------------------------------------------- /xdebug.ini: -------------------------------------------------------------------------------- 1 | ; Place this file in /etc/php5/conf.d 2 | extension=xdebug.so 3 | xdebug.auto_trace=On 4 | xdebug.trace_format=1 5 | xdebug.trace_output_dir=/var/log/php 6 | xdebug.show_mem_delta=On 7 | xdebug.var_display_max_data=128 8 | xdebug.collect_params=4 9 | xdebug.collect_return=On 10 | xdebug.trace_options=1 11 | xdebug.trace_output_name= %H-%p.trace 12 | xdebug.profiler_output_name = %s.%t.profile 13 | xdebug.profiler_output_dir=/var/log/php 14 | -------------------------------------------------------------------------------- /trace-code.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 9 | 10 || ' . ($i) . ' | ' . str_replace('<?php ', '', highlight_string(' |
Invalid file
'; 89 | } 90 | else 91 | { 92 | 93 | 94 | 95 | /** 96 | * és una manera molt poc eficient de llegir un arxiu. 97 | */ 98 | //$trace = file_get_contents($traceFile); 99 | //$lines = explode("\n", $trace); 100 | 101 | 102 | $previousLevel = 0; 103 | $levelIds = array(); 104 | $ids = 0; 105 | 106 | 107 | $defFn = get_defined_functions(); 108 | /** 109 | * counter 110 | */ 111 | $jCnt = 0; 112 | 113 | /** 114 | * Sumary 115 | */ 116 | $aSumary = array(); 117 | $aSumaryS = array(); 118 | 119 | /** 120 | * Process all lines 121 | */ 122 | //foreach ($lines as $line) 123 | $fh = fopen($traceFile, 'r'); 124 | while ($jReadedLine = fgets($fh)) 125 | { 126 | /** 127 | * Add one to the counter 128 | */ 129 | $jCnt++; 130 | 131 | switch ($xdebug_trace_format) 132 | { 133 | /** 134 | * xdebug.trace_format = 1 Computerized 135 | * @link http://www.xdebug.org/docs/all_settings#trace_format 136 | */ 137 | case 1: 138 | $data = explode("\t", $jReadedLine); 139 | @list($level, $id, $point, $time, $memory, $function, $type, $file, $filename, $line, $numParms) = $data; 140 | 141 | /** 142 | * if there is params save it 143 | */ 144 | if (isset($numParms) and $numParms > 0) 145 | { 146 | $valParms = ''; 147 | for ($i = 11; $i < (11 + $numParms); $i++) 148 | { 149 | $valParms .= "|
269 | = $traceFile; ?> 270 | = count($fullTrace); ?> function calls in seconds, using = $l['memoryOnEntry'] ?> MB of memory. 272 | |
273 | 274 | | in = start func. out = end func. |
275 | in = start func. out = end func. |
276 |
| Function / File | 279 |Line | 280 |Time | 281 |Memory | 282 |
|---|---|---|---|
306 | ☛ ☛ \= @$trace['function'] ?>
334 | = @$trace['filename'] ?> 335 | 336 | Warning, time jump exceeds trigger! {$trace['timeAlert']}"; 340 | } 341 | if (isset($trace['memoryAlert']) and $trace['memoryAlert']) 342 | { 343 | echo " Warning, memory jump exceeds trigger! {$trace['memoryAlert']}"; 344 | } 345 | ?> 346 | 347 | 348 | |
349 | 350 | {$trace['line']}"; 354 | } 355 | ?> 356 | | 357 |in: = @$trace['timeOnEntry'] ?> s out: = @$trace['timeOnExit'] ?> 359 | |
370 | in: = @$trace['memoryOnEntry'] ?> MB out: = @$trace['memoryOnExit'] ?> MB 372 | 373 | 374 | 385 | |
386 |
| Function | 439 |times | 440 |sum Time | 441 |sum Memory | 442 |avg Time | 443 |avg Memory | 444 |
|---|---|---|---|---|---|
| {$row['func']} | 470 |{$row['cnt']} | 471 |{$row['tim']} | 472 |{$row['mem']} | 473 |{$jAvgTim} | 474 |{$jAvgMem} | 475 | 476 |
| Script | 489 |instructions | 490 |sum Time | 491 |sum Memory | 492 |avg Time per inst | 493 |avg Memory per inst | 494 |
|---|---|---|---|---|---|
| {$row['filename']} | 519 |{$row['cnt']} | 520 |{$row['tim']} | 521 |{$row['mem']} | 522 |{$jAvgTim} | 523 |{$jAvgMem} | 524 |