/** report basic performance indicators in a single line * * This calculates the execution time of the script and the * number of queries. Note a special trick: we retrieve * the translated string in a dummy variable before calculating * the number of queries because otherwise we might miss one * or more query from the language/translation subsystem. * * Note that the message containing the performance indicators * is only generated when debug is TRUE; the information is not * that interesting for ordinary users. * * @param string $m left margin for increased readability * @return string performance report */ function get_bottomline($m = '') { global $CFG; $bottom_line = appropriate_legal_notices($this->text_only, $m) . "\n"; if ($CFG->debug) { $dummy = t('generated_in', 'admin'); $a = array('{DATE}' => strftime("%Y-%m-%d %T"), '{QUERIES}' => performance_get_queries(), '{SECONDS}' => sprintf("%01.3f", performance_get_seconds())); $bottom_line .= $m . "| " . t('generated_in', 'admin', $a) . "\n"; } return $bottom_line; }
/** show 'powered by' and (maybe) report basic performance indicators * * This calculates the execution time of the script and the * number of queries. Note a special trick: we retrieve * the translated string in a dummy variable before calculating * the number of queries because otherwise we might miss one * or more query from the language/translation subsystem. * * Note: for the time being the performance report commented out (2010-12-08). * Update: as from 2011-05-20 the performance report only displayed while debug is on, * * @param string $m left margin for increased readability * @return string performance report */ function get_bottomline($m = '') { global $CFG; $dummy = t('generated_in', 'admin'); $a = array('{DATE}' => strftime("%Y-%m-%d %T"), '{QUERIES}' => performance_get_queries(), '{SECONDS}' => sprintf("%01.3f", performance_get_seconds())); $s = appropriate_legal_notices($this->text_only, $m) . "\n"; if ($CFG->debug) { $separator = empty($this->quickbottom_separator) ? '' : $this->quickbottom_separator . ' '; // readability $s .= $m . $separator . t('generated_in', 'admin', $a) . "\n"; } return $s; }