Index: trunk/core/kernel/utility/debugger.php
===================================================================
diff -u -r4712 -r4758
--- trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 4712)
+++ trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 4758)
@@ -92,8 +92,9 @@
function Debugger()
{
$this->dummyImage = PROTOCOL.SERVER_NAME.(defined('PORT')?':'.PORT : '').rtrim(BASE_PATH, '/').'/'.'kernel/admin_templates/img/spacer.gif';
- $this->profileStart('kernel4_startup', 'Startup and Initialization of kernel4');
- $this->profileStart('script_runtime', 'Script runtime');
+ global $start;
+ $this->profileStart('kernel4_startup', 'Startup and Initialization of kernel4', $start);
+ $this->profileStart('script_runtime', 'Script runtime', $start);
ini_set('display_errors', dbg_ConstOn('DBG_ZEND_PRESENT') ? 0 : 1);
$this->memoryUsage['error_handling'] = 0; // memory amount used by error handler
@@ -224,9 +225,10 @@
$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();
+ $total_width = ($this->getWindowWidth()-10);
+ $div_width['before'] = round(($total_before / $total) * $total_width);
+ $div_width['current'] = round(($runtime / $total) * $total_width);
+ $div_width['left'] = round((($total - $total_before - $runtime) / $total) * $total_width);
$ret = 'Name: '.$Data['description'].'
';
$ret .= 'Runtime: '.$runtime.'s';
@@ -249,7 +251,7 @@
function getWindowWidth()
{
- return DBG_WINDOW_WIDTH - $this->scrollbarWidth;
+ return DBG_WINDOW_WIDTH - $this->scrollbarWidth - 8;
}
function isApplication(&$object)
@@ -480,9 +482,11 @@
}
}
- function profileStart($key, $description = null)
+ function profileStart($key, $description = null, $timeStamp=null)
{
- $timeStamp = $this->getMoment();
+ if (!isset($timeStamp)) {
+ $timeStamp = $this->getMoment();
+ }
$this->ProfilerData[$key] = Array('begins' => $timeStamp, 'ends' => 5000, 'debuggerRowID' => count($this->Data));
if (isset($description)) {
$this->ProfilerData[$key]['description'] = $description;
@@ -491,9 +495,12 @@
$this->Data[] = array('profile_key' => $key, 'debug_type' => 'profiler');
}
- function profileFinish($key, $description = null)
+ function profileFinish($key, $description = null, $timeStamp=null)
{
- $this->ProfilerData[$key]['ends'] = $this->getMoment();
+ if (!isset($timeStamp)) {
+ $timeStamp = $this->getMoment();
+ }
+ $this->ProfilerData[$key]['ends'] = $timeStamp;
if (isset($description)) {
$this->ProfilerData[$key]['description'] = $description;
@@ -603,44 +610,51 @@
$this->appendHTML('SQL Total time: '.$this->ProfilerTotals['sql'].' Number of queries: '.$this->ProfilerTotalCount['sql']);
}
+ if( dbg_ConstOn('DBG_PROFILE_INCLUDES') && isset($this->ProfilerTotals['includes']) )
+ {
+ $this->appendHTML('Included Files Total time: '.$this->ProfilerTotals['includes'].' Number of includes: '.$this->ProfilerTotalCount['includes']);
+ }
+
if( dbg_ConstOn('DBG_PROFILE_MEMORY') )
{
$this->appendHTML('Memory used by Objects: '.round($this->ProfilerTotals['objects']/1024, 2).'Kb');
}
- if( dbg_ConstOn('DBG_INCLUDED_FILES') )
+ /*if( dbg_ConstOn('DBG_INCLUDED_FILES') )
{
$files = get_included_files();
$this->appendHTML('Included files:');
foreach ($files as $file)
{
$this->appendHTML($this->getFileLink($this->getLocalFile($file)).' ('.round(filesize($file)/1024, 2).'Kb)');
}
- }
+ }*/
- if( dbg_ConstOn('DBG_PROFILE_INCLUDES') )
+ /*if( dbg_ConstOn('DBG_PROFILE_INCLUDES') )
{
$this->appendHTML('Included files statistics:'.( dbg_ConstOn('DBG_SORT_INCLUDES_MEM') ? ' (sorted by memory usage)':''));
$totals = Array( 'mem' => 0, 'time' => 0);
$totals_configs = Array( 'mem' => 0, 'time' => 0);
- if ( dbg_ConstOn('DBG_SORT_INCLUDES_MEM') ) {
- array_multisort($this->IncludesData['mem'], SORT_DESC, $this->IncludesData['file'], $this->IncludesData['time'], $this->IncludesData['level']);
- }
- foreach ($this->IncludesData['file'] as $key => $file_name) {
- $this->appendHTML( str_repeat(' -> ', ($this->IncludesData['level'][$key] >= 0 ? $this->IncludesData['level'][$key] : 0)).$file_name.' Mem: '.sprintf("%.4f Kb", $this->IncludesData['mem'][$key]/1024).' Time: '.sprintf("%.4f", $this->IncludesData['time'][$key]));
- if ($this->IncludesData['level'][$key] == 0) {
- $totals['mem'] += $this->IncludesData['mem'][$key];
- $totals['time'] += $this->IncludesData['time'][$key];
+ if (is_array($this->IncludesData['mem'])) {
+ if ( dbg_ConstOn('DBG_SORT_INCLUDES_MEM') ) {
+ array_multisort($this->IncludesData['mem'], SORT_DESC, $this->IncludesData['file'], $this->IncludesData['time'], $this->IncludesData['level']);
}
- else if ($this->IncludesData['level'][$key] == -1) {
- $totals_configs['mem'] += $this->IncludesData['mem'][$key];
- $totals_configs['time'] += $this->IncludesData['time'][$key];
+ foreach ($this->IncludesData['file'] as $key => $file_name) {
+ $this->appendHTML( str_repeat(' -> ', ($this->IncludesData['level'][$key] >= 0 ? $this->IncludesData['level'][$key] : 0)).$file_name.' Mem: '.sprintf("%.4f Kb", $this->IncludesData['mem'][$key]/1024).' Time: '.sprintf("%.4f", $this->IncludesData['time'][$key]));
+ if ($this->IncludesData['level'][$key] == 0) {
+ $totals['mem'] += $this->IncludesData['mem'][$key];
+ $totals['time'] += $this->IncludesData['time'][$key];
+ }
+ else if ($this->IncludesData['level'][$key] == -1) {
+ $totals_configs['mem'] += $this->IncludesData['mem'][$key];
+ $totals_configs['time'] += $this->IncludesData['time'][$key];
+ }
}
+ $this->appendHTML('Sub-Total classes: '.' Mem: '.sprintf("%.4f Kb", $totals['mem']/1024).' Time: '.sprintf("%.4f", $totals['time']));
+ $this->appendHTML('Sub-Total configs: '.' Mem: '.sprintf("%.4f Kb", $totals_configs['mem']/1024).' Time: '.sprintf("%.4f", $totals_configs['time']));
+ $this->appendHTML('Grand Total: '.' Mem: '.sprintf("%.4f Kb", ($totals['mem']+$totals_configs['mem'])/1024).' Time: '.sprintf("%.4f", $totals['time']+$totals_configs['time']));
}
- $this->appendHTML('Sub-Total classes: '.' Mem: '.sprintf("%.4f Kb", $totals['mem']/1024).' Time: '.sprintf("%.4f", $totals['time']));
- $this->appendHTML('Sub-Total configs: '.' Mem: '.sprintf("%.4f Kb", $totals_configs['mem']/1024).' Time: '.sprintf("%.4f", $totals_configs['time']));
- $this->appendHTML('Grand Total: '.' Mem: '.sprintf("%.4f Kb", ($totals['mem']+$totals_configs['mem'])/1024).' Time: '.sprintf("%.4f", $totals['time']+$totals_configs['time']));
- }
+ }*/
$i = 0; $lineCount = count($this->Data);
@@ -650,9 +664,11 @@
.dbg_profiler {
margin-top: 5px;
+ padding: 0px;
height: 10px;
border: 1px solid #000000;
float: left;
+ display: inline;
}
.dbg_flat_table {
@@ -953,6 +969,9 @@
{
$ret[]='