From d7b9ad99e6bc99091306550eddd4ade7e09b1147 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Wed, 2 Nov 2005 08:18:40 +0000 Subject: [PATCH] minor fixes: html output, speed, rtl lang --- ChangeLog | 2 + libraries/dbg/profiling.php | 95 +++++++++++++++++++------------------ 2 files changed, 52 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76f52f5b9..bc6df1139 100755 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ $Source$ * libraries/dbg/setup.php: - display error in error box - fixed 'not defined function' + * libraries/dbg/profiling.php: + - minor fixes: html output, speed, rtl lang 2005-11-01 Marc Delisle * server_privileges.php: undefined variable when changing a password diff --git a/libraries/dbg/profiling.php b/libraries/dbg/profiling.php index f04c71e53..83e0af180 100644 --- a/libraries/dbg/profiling.php +++ b/libraries/dbg/profiling.php @@ -17,60 +17,55 @@ if (isset($GLOBALS['DBG']) && $GLOBALS['DBG'] * LICENCE: This source file is subject to Mozilla Public License (MPL) * AUTHOR: Dmitri Dmitrienko */ - $dbg_prof_results = ""; // gma added var - dbg_get_profiler_results($dbg_prof_results); + dbg_get_profiler_results( $dbg_prof_results = '' ); $cwdlen = strlen(getcwd()); // gma added var, $cwdlen = strlen(getcwd()); - echo '
' . "\n" . - '' . "\n"; // gma change "." to ";" - $tr = '' . "\n" . // gma added "$tr =" - '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n"; // gma change "." to ";" - echo $tr.'' . "\n"; $lines = 0; // gma added "echo $tr." and "$lines = 0;" - foreach ($dbg_prof_results['line_no'] AS $idx => $line_no) { $lines++; // gma added "$lines++;" - $mod_no = $dbg_prof_results['mod_no'][$idx]; - $mod_name = ""; // gma added var - dbg_get_module_name($mod_no, $mod_name); + echo '
' . $GLOBALS['strDBGModule'] . '' . $GLOBALS['strDBGLine'] . '' . $GLOBALS['strDBGHits'] . '' . $GLOBALS['strDBGTimePerHitMs'] . '' . $GLOBALS['strDBGTotalTimeMs'] . '' . $GLOBALS['strDBGMinTimeMs'] . '' . $GLOBALS['strDBGMaxTimeMs'] . '' . $GLOBALS['strDBGContextID'] . '' . $GLOBALS['strDBGContext'] . '
' . "\n" . + '' . "\n"; + // gma added "$tr =" + $tr = '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n" . + '' . "\n"; // gma change "." to ";" + echo $tr.'' . "\n"; + $lines = 0; // gma added "echo $tr." and "$lines = 0;" + $ctx_name = ''; + $mod_name = ''; + $ctx_id = ''; + $odd_row = true; + foreach ( $dbg_prof_results['line_no'] as $idx => $line_no ) { + dbg_get_module_name( $dbg_prof_results['mod_no'][$idx], $mod_name ); //if (strpos("!".$mod_name, 'dbg.php') > 0) continue; - $hit_cnt = $dbg_prof_results['hit_count'][$idx]; - $time_sum = $dbg_prof_results['tm_sum'][$idx] * 1000; - $time_avg_hit = $time_sum / $hit_cnt; - $time_min = $dbg_prof_results['tm_min'][$idx] * 1000; - $time_max = $dbg_prof_results['tm_max'][$idx] * 1000; + $time_avg_hit = $time_sum / $dbg_prof_results['hit_count'][$idx]; - $time_sum = sprintf('%.3f', $time_sum); + $time_sum = sprintf( '%.3f', $time_sum ); $time_avg_hit = sprintf('%.3f', $time_avg_hit); - $time_min = sprintf('%.3f', $time_min); - $time_max = sprintf('%.3f', $time_max); - $ctx_id = ""; // gma added var - dbg_get_source_context($mod_no, $line_no, $ctx_id); + $time_min = sprintf( '%.3f', $dbg_prof_results['tm_min'][$idx] * 1000 ); + $time_max = sprintf( '%.3f', $dbg_prof_results['tm_max'][$idx] * 1000 ); + dbg_get_source_context( $dbg_prof_results['mod_no'][$idx], + $line_no, $ctx_id ); - //use a default context name if needed - $ctx_name = ""; // gma added var - if (dbg_get_context_name($ctx_id, $ctx_name) - && strcmp($ctx_name,'') == 0) { + // use a default context name if needed + if ( dbg_get_context_name( $ctx_id, $ctx_name ) + && strlen($ctx_name) == 0 ) { $ctx_name = "::main"; } - $bk = "#ffffff"; - if (($idx & 1) == 0) - $bk = "#e0e0e0"; - - if ($time_avg_hit > $GLOBALS['cfg']['DBG']['profile']['threshold'] ) { - echo '' . - '' . // gma changed "$mod_name" to "substr($mod_name,$cwdlen+1)" + if ( $time_avg_hit > $GLOBALS['cfg']['DBG']['profile']['threshold'] ) { + echo '' . + // gma changed "$mod_name" to "substr($mod_name,$cwdlen+1)" + '' . '' . - '' . + '' . '' . '' . '' . @@ -78,17 +73,27 @@ if (isset($GLOBALS['DBG']) && $GLOBALS['DBG'] '' . '' . '' . "\n"; - if($lines == 20) { $lines = 0; echo $tr;} // gma added line. Repeats the header every x lines. + + // gma added line. Repeats the header every x lines. + if ( $lines === 19 ) { + $odd_row = true; + $lines = 0; + echo $tr; + } else { + $odd_row = ! $odd_row; + $lines++; + } } } - echo "
' . $GLOBALS['strDBGModule'] . '' . $GLOBALS['strDBGLine'] . '' . $GLOBALS['strDBGHits'] . '' . $GLOBALS['strDBGTimePerHitMs'] . '' . $GLOBALS['strDBGTotalTimeMs'] . '' . $GLOBALS['strDBGMinTimeMs'] . '' . $GLOBALS['strDBGMaxTimeMs'] . '' . $GLOBALS['strDBGContextID'] . '' . $GLOBALS['strDBGContext'] . '
' . substr($mod_name,$cwdlen+1) . '
' . substr($mod_name,$cwdlen+1) . '' . $line_no . '' . $hit_cnt . '' . $dbg_prof_results['hit_count'][$idx] . '' . $time_avg_hit . '' . $time_sum . '' . $time_min . '' . $ctx_id . '' . $ctx_name . '
"; + echo ''; } } /* gma ... Developer Notes These two scriptlets can be used as On/Off buttons in your browsers, add to links. ON: javascript: document.cookie = 'DBGSESSID=' + escape('1;d=1,p=1') + '; path=/'; document.execCommand('refresh'); -or ... javascript: document.cookie = 'DBGSESSID=' + escape('1;d=0,p=1') + '; path=/'; document.execCommand('refresh'); +or ... +javascript: document.cookie = 'DBGSESSID=' + escape('1;d=0,p=1') + '; path=/'; document.execCommand('refresh'); OFF: javascript: document.cookie = 'DBGSESSID=' + escape('1;d=0,p=0') + '; path=/'; document.execCommand('refresh'); */