Skip to content

Config run information

Bart van Hoekelen edited this page Jun 28, 2017 · 1 revision

Tables of contents

Purpose

Display the current username ('whoami') and the process id.

Code

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

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

Exemple

Note: pay attention the line 'Run by user ... on process id ... '.

PHP performance tool - Config::setRunInformation(true)

Code fragment

use Performance\Performance;
use Performance\Config;

class Foo
{
    public function __construct()
    {
        // Set config item for display user and process id
        Config::setRunInformation(true);

        $this->synchronizeTaskARun();

        // 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();
    }
}
Clone this wiki locally