Added XDebug tools

This commit is contained in:
Laurent Destailleur 2009-02-21 01:04:35 +00:00
parent 801bf75f58
commit 75b738eff9
3 changed files with 21 additions and 14 deletions

View File

@ -1603,6 +1603,13 @@ function dol_print_error($db='',$error='')
$syslog.=", msg=".$msg; $syslog.=", msg=".$msg;
} }
} }
if ($_SERVER['DOCUMENT_ROOT'] && function_exists('xdebug_call_file'))
{
print '<b>XDebug informations:</b>'."<br>\n";
print 'File: '.xdebug_call_file()."<br>\n";
print 'Line: '.xdebug_call_line()."<br>\n";
print "<br>\n";
}
dol_syslog("Error ".$syslog, LOG_ERR); dol_syslog("Error ".$syslog, LOG_ERR);
} }

View File

@ -36,6 +36,9 @@ if (! empty($_SERVER['DOL_TUNING']))
{ {
list($usec, $sec) = explode(" ", microtime()); list($usec, $sec) = explode(" ", microtime());
$micro_start_time=((float)$usec + (float)$sec); $micro_start_time=((float)$usec + (float)$sec);
// Add Xdebug coverage of code
//define('XDEBUGCOVERAGE',1);
if (defined('XDEBUGCOVERAGE')) { xdebug_start_code_coverage(); }
} }
@ -1015,13 +1018,22 @@ function llxFooter($foot='',$limitIEbug=1)
print "\n".'<script type="text/javascript">window.status="Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms'; print "\n".'<script type="text/javascript">window.status="Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms';
if (function_exists("memory_get_usage")) if (function_exists("memory_get_usage"))
{ {
print ' - Memory usage: '.memory_get_usage(); print ' - Mem: '.memory_get_usage();
}
if (function_exists("xdebug_memory_usage"))
{
print ' - XDebug time: '.ceil(1000*xdebug_time_index()).' ms';
print ' - XDebug mem: '.xdebug_memory_usage();
print ' - XDebug mem peak: '.xdebug_peak_memory_usage();
} }
if (function_exists("zend_loader_file_encoded")) if (function_exists("zend_loader_file_encoded"))
{ {
print ' - Zend encoded file: '.(zend_loader_file_encoded()?'yes':'no'); print ' - Zend encoded file: '.(zend_loader_file_encoded()?'yes':'no');
} }
print '"</script>'."\n"; print '"</script>'."\n";
// Add Xdebug coverage of code
if (defined('XDEBUGCOVERAGE')) { var_dump(xdebug_get_code_coverage()); }
} }
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
@ -1030,7 +1042,7 @@ function llxFooter($foot='',$limitIEbug=1)
} }
// Juste pour eviter bug IE qui reorganise mal div precedents si celui-ci absent // Juste pour eviter bug IE qui reorganise mal div precedents si celui-ci absent
if ($limitIEbug && empty($conf->browser->firefox)) print "\n".'<div class="tabsAction">&nbsp;</div>'."\n"; //if ($limitIEbug && empty($conf->browser->firefox)) print "\n".'<div class="tabsAction">&nbsp;</div>'."\n";
// If there is some logs in buffer to show // If there is some logs in buffer to show
if (sizeof($conf->logbuffer)) if (sizeof($conf->logbuffer))
@ -1049,9 +1061,6 @@ function llxFooter($foot='',$limitIEbug=1)
print "\n"; print "\n";
if ($foot) print '<!-- '.$foot.' -->'."\n"; if ($foot) print '<!-- '.$foot.' -->'."\n";
// Add Xdebug coverage of code
if (defined('XDEBUGCOVERAGE')) { var_dump(xdebug_get_code_coverage()); }
print "</body>\n"; print "</body>\n";
print "</html>\n"; print "</html>\n";
} }

View File

@ -33,15 +33,6 @@
define('DOL_VERSION','2.6-beta'); // Also defined in htdocs/install/inc.php define('DOL_VERSION','2.6-beta'); // Also defined in htdocs/install/inc.php
define('EURO',chr(128)); define('EURO',chr(128));
// Add Xdebug coverage of code
//define('XDEBUGCOVERAGE',1);
if (defined('XDEBUGCOVERAGE')) { xdebug_start_code_coverage(); }
// La fonction clearstatcache ne doit pas etre appelée de manière globale car ralenti.
// Elle doit etre appelée uniquement par les pages qui ont besoin d'un cache fichier vidé
// comme par exemple document.php
//clearstatcache();
// Definition des constantes syslog // Definition des constantes syslog
if (function_exists("define_syslog_variables")) if (function_exists("define_syslog_variables"))
{ {