Documentation TYPO3 par Ameos

profiling.php

00001 <?php
00002 /* $Id: profiling.php,v 2.3 2003/11/26 22:52:25 rabus 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 
00021         dbg_get_profiler_results(&$dbg_prof_results);
00022 
00023         echo '<br><table width="1000" cellspacing="0" cellpadding="2" style="font:8pt courier">' . "\n" .
00024             '<thead>' . "\n" .
00025             '<tr style="background:#808080; color:#FFFFFF">' . "\n" .
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" .
00036             '<tbody style="vertical-align: top">' . "\n";
00037         foreach($dbg_prof_results['line_no'] AS $idx => $line_no) {
00038             $mod_no = $dbg_prof_results['mod_no'][$idx];
00039             dbg_get_module_name($mod_no, &$mod_name);
00040 
00041             //if (strpos("!".$mod_name, 'dbg.php') > 0) continue;
00042 
00043             $hit_cnt = $dbg_prof_results['hit_count'][$idx];
00044 
00045             $time_sum = $dbg_prof_results['tm_sum'][$idx] * 1000;
00046             $time_avg_hit = $time_sum / $hit_cnt;
00047             $time_min = $dbg_prof_results['tm_min'][$idx] * 1000;
00048             $time_max = $dbg_prof_results['tm_max'][$idx] * 1000;
00049 
00050             $time_sum = sprintf('%.3f', $time_sum);
00051             $time_avg_hit = sprintf('%.3f', $time_avg_hit);
00052             $time_min = sprintf('%.3f', $time_min);
00053             $time_max = sprintf('%.3f', $time_max);
00054 
00055             dbg_get_source_context($mod_no, $line_no, &$ctx_id);
00056 
00057             //use a default context name if needed
00058             if (dbg_get_context_name($ctx_id, &$ctx_name)
00059                     && strcmp($ctx_name,'') == 0) {
00060                 $ctx_name = "::main";
00061             }
00062 
00063             $bk = "#ffffff";
00064             if (($idx & 1) == 0)
00065                 $bk = "#e0e0e0";
00066 
00067             if($time_avg_hit > $GLOBALS['cfg']['DBG']['profile']['threshold'] ) {
00068                 echo '<tr style="background:' . $bk . '">' .
00069                     '<td>' . $mod_name . '</td>' .
00070                     '<td>' . $line_no . '</td>' .
00071                     '<td>' . $hit_cnt . '</td>' .
00072                     '<td>' . $time_avg_hit . '</td>' .
00073                     '<td>' . $time_sum . '</td>' .
00074                     '<td>' . $time_min . '</td>' .
00075                     '<td>' . $time_max . '</td>' .
00076                     '<td>' . $ctx_id . '</td>' .
00077                     '<td>' . $ctx_name . '</td>' .
00078                     '</tr>' . "\n";
00079             }
00080         }
00081         echo "</tbody></table>";
00082     }
00083 }
00084 
00085 ?>


Généré par TYPO3 Ameos avec  doxygen 1.4.6