MyMomSaysIamSpecial MyMomSaysIamSpecial - 3 years ago 343
Smarty Question

CodeIgniter benchmarking with Smarty

I've connected Smarty to CodeIgniter and now of course i cant use {memory_used} and {elapsed_time}, but i want to know how i can output this information to my webpage now?

Answer Source

Benchmark class


They do return their mustached values that are parsed by output class later, so if you use Smarty, you can basically use the raw functions CodeIgniter uses itself.

$memory = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB';
global $BM; // needed only for elapsed_time
$elapsed_time = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end');

Note it is really a workaround and there should be better ways to do it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download