Index: trunk/kernel/include/debugger.php =================================================================== diff -u -r3685 -r3815 --- trunk/kernel/include/debugger.php (.../debugger.php) (revision 3685) +++ trunk/kernel/include/debugger.php (.../debugger.php) (revision 3815) @@ -70,6 +70,7 @@ var $OptionsMap = Array('shutdown_func' => 1, 'error_handler' => 2, 'output_buffer' => 4, 'highlight_output' => 8); + var $scrollbarWidth = 0; var $longErrors=Array(); @@ -86,12 +87,17 @@ 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 + + $this->scrollbarWidth = $this->isGecko() ? 22 : 25; + dbg_safeDefine('DBG_WINDOW_WIDTH', 700); $this->appendRequest(); } @@ -209,7 +215,29 @@ $profileKey = $Data['profile_key']; $Data =& $this->ProfilerData[$profileKey]; $runtime = ($Data['ends'] - $Data['begins']); // in seconds + + + $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 ($this->isGecko()) { return ''.$title.''; } - else - { + else { return ''.$title.''; } @@ -406,7 +442,7 @@ ob_start(); ?> - +
@@ -472,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]++; } @@ -541,7 +583,6 @@ if( dbg_ConstOn('DBG_ZEND_PRESENT') ) return; dbg_safeDefine('DBG_RAISE_ON_WARNINGS',0); - dbg_safeDefine('DBG_WINDOW_WIDTH', 700); $this->memoryUsage['debugger_start']=memory_get_usage(); @@ -602,6 +643,13 @@ ?>
SrcNameValue