/** * Show benchmark table * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_benchmark($params, &$smarty) { if (DEBUG < DEBUG_DEVELOPMENT) { return ''; } // if $benchmark =& BenchmarkTimer::instance(); $db =& DBConnection::instance(); $result = array('Executed in: ' . (double) number_format($benchmark->TimeElapsed(), 3) . 's', 'SQL queries: ' . $db->query_counter); if (function_exists('memory_get_usage')) { $result[] = 'Memory usage: ' . number_format(memory_get_usage() / 1048576, 2, '.', ',') . 'MB'; } // if return '<p id="benchmark">' . implode('. ', $result) . '</p>'; }
/** * Display data that timer collected * * @access public * @param boolean $show_total Show total time * @param boolean $display Render or return * @return mixed */ function benchmark_timer_display($full = true) { $timer =& BenchmarkTimer::instance(); $timer->display($full); }
/** * Set marker * * @param string $marker_name Marker name * @return null */ function benchmark_timer_set_marker($marker_name) { $timer =& BenchmarkTimer::instance(); $timer->setMarker($marker_name); }