Skip to content
This repository was archived by the owner on Feb 17, 2022. It is now read-only.

7.x 2.x helper profile

Andy Truong edited this page Dec 26, 2013 · 1 revision

Profile code [7.x-2.x]

$timer = at_container('helper.timer');
// Set the callback — code to be benchmarked
$timer->setCallback(function() { $modules = at_modules('at_base'); });

// Run it 10 times
$timer->setTimes(10);

// Profile the callback with xhprof
// If we defined $conf['at_xhprof_domain'] and $conf['at_xhprof_root'] in
// settings.php, then we just need callback setXProfConfig with empty array
// $timer->setXProfConfig()
$timer->setXProfConfig(array('domain' => 'http://xhprof.example.com/', 'root' => '/var/www/'));

// Now, start benchmarking
$data = $timer->run();

Clone this wiki locally