MDL-15273 basic read/write perf counter in moodle_database

This commit is contained in:
skodak 2008-06-16 21:01:54 +00:00
parent 45d4986761
commit ab130a0b5f
9 changed files with 90 additions and 27 deletions

View file

@ -7539,7 +7539,7 @@ function array_is_nested($array) {
***
**/
function get_performance_info() {
global $CFG, $PERF;
global $CFG, $PERF, $DB;
$info = array();
$info['html'] = ''; // holds userfriendly HTML representation
@ -7569,18 +7569,16 @@ function get_performance_info() {
$info['html'] .= '<span class="included">Included '.$info['includecount'].' files</span> ';
$info['txt'] .= 'includecount: '.$info['includecount'].' ';
if (!empty($PERF->dbqueries)) {
$info['dbqueries'] = $PERF->dbqueries;
$info['html'] .= '<span class="dbqueries">DB queries '.$info['dbqueries'].'</span> ';
$info['txt'] .= 'dbqueries: '.$info['dbqueries'].' ';
}
if (!empty($PERF->logwrites)) {
$info['logwrites'] = $PERF->logwrites;
$info['html'] .= '<span class="logwrites">Log writes '.$info['logwrites'].'</span> ';
$info['html'] .= '<span class="logwrites">Log DB writes '.$info['logwrites'].'</span> ';
$info['txt'] .= 'logwrites: '.$info['logwrites'].' ';
}
$info['dbqueries'] = $DB->perf_get_reads().'/'.($DB->perf_get_writes() - $PERF->logwrites);
$info['html'] .= '<span class="dbqueries">DB reads/writes: '.$info['dbqueries'].'</span> ';
$info['txt'] .= 'db reads/writes: '.$info['dbqueries'].' ';
if (!empty($PERF->profiling) && $PERF->profiling) {
require_once($CFG->dirroot .'/lib/profilerlib.php');
$info['html'] .= '<span class="profilinginfo">'.Profiler::get_profiling(array('-R')).'</span>';