Skip to content

Config point label nice

Bart van Hoekelen edited this page Apr 26, 2017 · 3 revisions

Tables of contents

Purpose

Converter point label from 'CamelCase' to 'Camel Case'.

Code

// Add namespace at the top 
use Performance\Config;

// Set config
Config::setPointLabelNice(true);
Config::setPointLabelNice($status);
Item Type Accept Default Required
$status bool true or false false yes

Exemple

Note: pay attention on the point label name.

Query log resume

PHP performance tool - Config::setPointLabelNice(true)

Query log full

PHP performance tool - Config::setPointLabelNice(true, 'full')

Code fragment

use Performance\Performance;
use Performance\Config;

class Foo
{
    public function __construct()
    {
        // The point label nice wil converter 'CamelCase' to 'Camel case'
        Config::setPointLabelNice(true);

        $this->synchronizeTaskARun();
        $this->synchronizeTaskBRun();
        $this->synchronizeTaskCRun();

        // Finish all tasks and show test results
        Performance::results();
    }

    public function synchronizeTaskARun()
    {
        // Set point Task A
        Performance::point(__FUNCTION__);

        //
        // Run code
        usleep(2000);
        //

        // Finish point Task A
        Performance::finish();
    }

    public function synchronizeTaskBRun()
    {
        // Set point Task B
        Performance::point(__FUNCTION__);

        //
        // Run code
        usleep(2000);
        //

        // Finish point Task B
        Performance::finish();
    }

    public function synchronizeTaskCRun()
    {
        // Set point Task C
        Performance::point(__FUNCTION__);

        //
        // Run code
        usleep(2000);
        //

        // Finish point Task C
        Performance::finish();
    }
}