Index: trunk/core/kernel/utility/debugger.php =================================================================== diff -u -N -r3764 -r3815 --- trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 3764) +++ trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 3815) @@ -70,28 +70,34 @@ var $OptionsMap = Array('shutdown_func' => 1, 'error_handler' => 2, 'output_buffer' => 4, 'highlight_output' => 8); + var $scrollbarWidth = 0; + + var $longErrors = Array(); - var $longErrors=Array(); - /** * Amount of memory used by debugger itself * * @var Array * @access private */ - var $memoryUsage=Array(); + var $memoryUsage = Array(); - var $IncludesData=Array(); - var $IncludeLevel=0; + var $IncludesData = Array(); + var $IncludeLevel = 0; var $reportDone = false; + var $dummyImage = 'http://www.adamauto.lv/chevrolet/images/spacer.gif'; + function Debugger() { $this->profileStart('kernel4_startup', 'Startup and Initialization of kernel4'); $this->profileStart('script_runtime', 'Script runtime'); - ini_set('display_errors',dbg_ConstOn('DBG_ZEND_PRESENT')?0:1); - $this->memoryUsage['error_handling']=0; // memory amount used by error handler + ini_set('display_errors', dbg_ConstOn('DBG_ZEND_PRESENT') ? 0 : 1); + $this->memoryUsage['error_handling'] = 0; // memory amount used by error handler + + $this->scrollbarWidth = $this->isGecko() ? 22 : 25; + dbg_safeDefine('DBG_WINDOW_WIDTH', 700); $this->appendRequest(); } @@ -133,7 +139,7 @@ */ function traceNext() { - $this->TraceNextError=true; + $this->TraceNextError = true; } function dumpVars() @@ -209,7 +215,29 @@ $profileKey = $Data['profile_key']; $Data =& $this->ProfilerData[$profileKey]; $runtime = ($Data['ends'] - $Data['begins']); // in seconds - return 'Name: '.$Data['description'].'
Runtime: '.$runtime.'s'; + + + $totals_key = getArrayValue($Data, 'totalsKey'); + if ($totals_key) { + $total_before = $Data['totalsBefore']; + $total = $this->ProfilerTotals[$totals_key]; + + $div_width = Array(); + $div_width['before'] = ($total_before / $total) * $this->getWindowWidth(); + $div_width['current'] = ($runtime / $total) * $this->getWindowWidth(); + $div_width['left'] = (($total - $total_before - $runtime) / $total) * $this->getWindowWidth(); + + $ret = 'Name: '.$Data['description'].'
'; + $ret .= 'Runtime: '.$runtime.'s'; + $ret .= '
'; + $ret .= '
'; + $ret .= '
'; + + return $ret; + } + else { + return 'Name: '.$Data['description'].'
Runtime: '.$runtime.'s'; + } break; default: @@ -218,6 +246,11 @@ } } + function getWindowWidth() + { + return DBG_WINDOW_WIDTH - $this->scrollbarWidth; + } + function isApplication(&$object) { $app_class = defined('APPLICATION_CLASS') ? strtolower(APPLICATION_CLASS) : 'kApplication'; @@ -295,24 +328,27 @@ $string = str_replace( Array('\\', '/') , Array('_no_match_string_', '_n_m_s_'), $string); $string = highlight_string('', true); $string = str_replace( Array('_no_match_string_', '_n_m_s_'), Array('\\', '/'), $string); - return preg_replace('/<\?(.*)php (.*)\?>/s', '$2', $string); + return preg_replace('/<\?php(.*)\?>/s', '\\1', $string); } else { return $string; } } - + + function isGecko() + { + return strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'firefox') !== false; + } + function getFileLink($file, $lineno = 1, $title = '') { - if(!$title) $title = $file; - $is_mozilla=strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'firefox')!==false?true:false; - if($is_mozilla) - { + if (!$title) $title = $file; + + if ($this->isGecko()) { return ''.$title.''; } - else - { + else { return ''.$title.''; } @@ -393,8 +429,6 @@ function appendRequest() { - dbg_safeDefine('DBG_WINDOW_WIDTH', 700); - if (isset($_SERVER['SCRIPT_FILENAME'])) { $script = $_SERVER['SCRIPT_FILENAME']; } @@ -408,7 +442,7 @@ ob_start(); ?> - +
@@ -474,6 +508,12 @@ if (!isset($value)) { $value = $this->ProfilerData[$key]['ends'] - $this->ProfilerData[$key]['begins']; } + + if (isset($key)) { + $this->ProfilerData[$key]['totalsKey'] = $total_key; + $this->ProfilerData[$key]['totalsBefore'] = $this->ProfilerTotals[$total_key]; + } + $this->ProfilerTotals[$total_key] += $value; $this->ProfilerTotalCount[$total_key]++; } @@ -603,6 +643,13 @@ ?>
SrcNameValue