Skip to content

Export handler

Bart van Hoekelen edited this page Feb 19, 2018 · 4 revisions

Tables of contents

Purpose

Export points and config to array, json or file.

Code

// Finish all tasks and show test results
$export = Performance::results(); // Print and return export handler
// OR USE
$export = Performance::export(); // Only return export handler

// Return all information
print_r($export->get());

Exemple

Note: pay attention on the point label name.

Export to array object

$export = Performance::export(); // Only return export

// Return all information
print_r($export->get());

PHP performance tool export to array object

Export to Json

$export = Performance::export(); // Only return export

// Return all information
print_r($export->toJson());

PHP performance tool export to Json

Export to file

$export = Performance::export(); // Only return export

// Return all information
print_r($export->toFile('export.txt'));

PHP performance tool export to file

Code fragment

use Performance\Performance;

/*
 * One simply performance check
 */

Performance::point();
// Run task A
for($x = 0; $x < 100; $x++)
{
    echo ".";
}

Performance::message('This is a message');

// Finish all tasks and show test results
$export = Performance::results(); // Print and return export handler
// OR USE
$export = Performance::export(); // Only return export handler

// Return all information
print_r($export->get());

// Return all information in Json
print_r($export->toJson());

// Return only config
print_r($export->config()->get());

// Return only points in Json
print_r($export->points()->toJson());

// Export to file
print_r($export->toFile('export.txt'));