Documentation TYPO3 par Ameos

profiling.php

00001 <?php
00002 /* $Id: profiling.php,v 2.7 2005/07/29 17:18:56 lem9 Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']
00006         && isset($GLOBALS['cfg']['DBG']['profile']['enable'])
00007         && $GLOBALS['cfg']['DBG']['profile']['enable']) {
00008 
00013     function dbg_dump_profiling_results() {
00014         /* Applies to the original 'dbg_dump_profiling_results' function,
00015          * sourced from http://dd.cron.ru/dbg/download.php?h=prof_sample2
00016          * Copyright (c) 2002. Dmitri Dmitrienko
00017          * LICENCE: This source file is subject to Mozilla Public License (MPL)
00018          * AUTHOR: Dmitri Dmitrienko <dd@cron.ru>
00019          */
00020         $dbg_prof_results = ""; // gma added var
00021         dbg_get_profiler_results($dbg_prof_results);
00022         $cwdlen =  strlen(getcwd()); // gma added var, $cwdlen =  strlen(getcwd());
00023         echo '<br /><table width="1000" cellspacing="0" cellpadding="2" style="font:8pt courier">' . "\n" .
00024             '<thead>' . "\n";  // gma change "." to ";"
00025         $tr = '<tr style="background:#808080; color:#FFFFFF">' . "\n" . // gma added "$tr ="
00026             '<td>' . $GLOBALS['strDBGModule'] . '</td>' . "\n" .
00027             '<td>' . $GLOBALS['strDBGLine'] . '</td>' . "\n" .
00028             '<td>' . $GLOBALS['strDBGHits'] . '</td>' . "\n" .
00029             '<td>' . $GLOBALS['strDBGTimePerHitMs'] . '</td>' . "\n" .
00030             '<td>' . $GLOBALS['strDBGTotalTimeMs'] . '</td>' . "\n" .
00031             '<td>' . $GLOBALS['strDBGMinTimeMs'] . '</td>' . "\n" .
00032             '<td>' . $GLOBALS['strDBGMaxTimeMs'] . '</td>' . "\n" .
00033             '<td>' . $GLOBALS['strDBGContextID'] . '</td>' . "\n" .
00034             '<td>' . $GLOBALS['strDBGContext'] . '</td>' . "\n" .
00035             '</tr></thead>' . "\n";  // gma change "." to ";"
00036         echo $tr.'<tbody style="vertical-align: top">' . "\n";  $lines = 0; // gma added "echo $tr." and "$lines = 0;"
00037         foreach ($dbg_prof_results['line_no'] AS $idx => $line_no) { $lines++; // gma added "$lines++;"
00038             $mod_no = $dbg_prof_results['mod_no'][$idx];
00039             $mod_name = ""; // gma added var
00040             dbg_get_module_name($mod_no, $mod_name);
00041 
00042             //if (strpos("!".$mod_name, 'dbg.php') > 0) continue;
00043 
00044             $hit_cnt = $dbg_prof_results['hit_count'][$idx];
00045 
00046             $time_sum = $dbg_prof_results['tm_sum'][$idx] * 1000;
00047             $time_avg_hit = $time_sum / $hit_cnt;
00048             $time_min = $dbg_prof_results['tm_min'][$idx] * 1000;
00049             $time_max = $dbg_prof_results['tm_max'][$idx] * 1000;
00050 
00051             $time_sum = sprintf('%.3f', $time_sum);
00052             $time_avg_hit = sprintf('%.3f', $time_avg_hit);
00053             $time_min = sprintf('%.3f', $time_min);
00054             $time_max = sprintf('%.3f', $time_max);
00055             $ctx_id = ""; // gma added var
00056             dbg_get_source_context($mod_no, $line_no, $ctx_id);
00057 
00058             //use a default context name if needed
00059             $ctx_name = ""; // gma added var
00060             if (dbg_get_context_name($ctx_id, $ctx_name)
00061                     && strcmp($ctx_name,'') == 0) {
00062                 $ctx_name = "::main";
00063             }
00064 
00065             $bk = "#ffffff";
00066             if (($idx & 1) == 0)
00067                 $bk = "#e0e0e0";
00068 
00069             if ($time_avg_hit > $GLOBALS['cfg']['DBG']['profile']['threshold'] ) {
00070                 echo '<tr style="background:' . $bk . '">' .
00071                     '<td>' . substr($mod_name,$cwdlen+1) . '</td>' .  // gma changed "$mod_name" to "substr($mod_name,$cwdlen+1)"
00072                     '<td>' . $line_no . '</td>' .
00073                     '<td>' . $hit_cnt . '</td>' .
00074                     '<td>' . $time_avg_hit . '</td>' .
00075                     '<td>' . $time_sum . '</td>' .
00076                     '<td>' . $time_min . '</td>' .
00077                     '<td>' . $time_max . '</td>' .
00078                     '<td>' . $ctx_id . '</td>' .
00079                     '<td>' . $ctx_name . '</td>' .
00080                     '</tr>' . "\n";
00081                 if($lines == 20) { $lines = 0; echo $tr;}  // gma added line. Repeats the header every x lines.
00082             }
00083         }
00084         echo "</tbody></table>";
00085     }
00086 }
00087 /*  gma ... Developer Notes
00088 These two scriptlets can be used as On/Off buttons in your browsers, add to links. 
00089 ON:
00090 javascript: document.cookie = 'DBGSESSID=' + escape('1;d=1,p=1') + '; path=/'; document.execCommand('refresh'); 
00091 or ... javascript: document.cookie = 'DBGSESSID=' + escape('1;d=0,p=1') + '; path=/'; document.execCommand('refresh');
00092 OFF:
00093 javascript: document.cookie = 'DBGSESSID=' + escape('1;d=0,p=0') + '; path=/'; document.execCommand('refresh');
00094 */
00095 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6