-
Notifications
You must be signed in to change notification settings - Fork 37
Doc how to use
Bart van Hoekelen edited this page Apr 26, 2017
·
1 revision
Fast and easy.
// Add namespace at the top
use Performance\Performance;
// Set measure point
Performance::point();
//
// Run test code
//
// Finish all tasks and show test results
Performance::results();
Scalable, point label is automatically filled in by the function name.
use Performance\Performance;
use Performance\Config;
class Foo
{
public function __construct()
{
// You can specify the characters you want to strip
Config::setPointLabelLTrim('synchronize');
Config::setPointLabelRTrim('Run');
Config::setPointLabelNice(true);
$this->synchronizeTaskA();
$this->synchronizeTaskB();
// Finish all tasks and show test results
Performance::results();
}
public function synchronizeTaskA()
{
// Set point Task A
Performance::point(__FUNCTION__);
//
// Run code
sleep(1);
//
// Finish point Task A
Performance::finish();
}
public function synchronizeTaskB()
{
// Set point Task B
Performance::point(__FUNCTION__);
//
// Run code
sleep(1);
//
// Finish point Task B
Performance::finish();
}
}
Return to wiki home page