forked from leftypol/leftypol
profile.php: reduce logging
This commit is contained in:
parent
4f2bd22fae
commit
fd04d92c48
1 changed files with 1 additions and 4 deletions
|
@ -3,16 +3,13 @@
|
||||||
// Inject with `auto_prepend_file` in php.ini
|
// Inject with `auto_prepend_file` in php.ini
|
||||||
|
|
||||||
if (extension_loaded("excimer")) {
|
if (extension_loaded("excimer")) {
|
||||||
error_log("Profiler started", 0);
|
|
||||||
|
|
||||||
static $prof; // Keep object until the end of the request
|
static $prof; // Keep object until the end of the request
|
||||||
$prof = new ExcimerProfiler();
|
$prof = new ExcimerProfiler();
|
||||||
$prof->setEventType(EXCIMER_REAL);
|
$prof->setEventType(EXCIMER_REAL);
|
||||||
$prof->setPeriod(5); // every N seconds
|
$prof->setPeriod(0.2); // every N seconds
|
||||||
$prof->setMaxDepth(250);
|
$prof->setMaxDepth(250);
|
||||||
|
|
||||||
$prof->setFlushCallback(function ($log) {
|
$prof->setFlushCallback(function ($log) {
|
||||||
error_log("Logged profile", 0);
|
|
||||||
file_put_contents('/tmp/profles-ramfs/excimer-traces.log', $log->formatCollapsed(), FILE_APPEND | LOCK_EX);
|
file_put_contents('/tmp/profles-ramfs/excimer-traces.log', $log->formatCollapsed(), FILE_APPEND | LOCK_EX);
|
||||||
}, 1);
|
}, 1);
|
||||||
$prof->start();
|
$prof->start();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue