PHP code example of aeatech / snapshot-profiler-newrelic
1. Go to this page and download the library: Download aeatech/snapshot-profiler-newrelic library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aeatech / snapshot-profiler-newrelic example snippets
declare(strict_types=1);
use AEATech\SnapshotProfiler\Profiler;
use AEATech\SnapshotProfilerNewrelic\Adapter;
use AEATech\SnapshotProfilerNewrelic\Saver;
Adapter::OPTION_KEY_SNAPSHOT_NAME => 'snapshot name',
/**
* It must be true for cli processes or false for web processes
*/
Adapter::OPTION_KEY_IS_BACKGROUND_PROCESS => true,
Adapter::OPTION_KEY_CUSTOM_PARAMETERS => [
'parameter 1' => true,
'parameter 2' => 2,
'parameter 3' => 3.14,
'parameter 4' => 'string value',
],
];
/**
* End initialization
*/
/**
* Start profiling
*/
$profiler->enable();
$profiler->setProfilingOptions($profilingOptions);
for ($i = 0; $i < 10; $i++) {
random_int(1, 10);
}
/**
* $data is always empty and added for backward compatibility with xhprof
*/
$data = $profiler->disable();
/**
* End profiling
*/
/**
* Start customization (not necessarily)
*/
/**
* Save profiling result
* It's doing nothing and added for backward compatibility with xhprof
*/
$saver->save($data);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.