profile.php: reduce logging

This commit is contained in:
Zankaria 2024-06-22 23:49:56 +02:00
parent 4f2bd22fae
commit fd04d92c48

View file

@ -3,16 +3,13 @@
// Inject with `auto_prepend_file` in php.ini
if (extension_loaded("excimer")) {
error_log("Profiler started", 0);
static $prof; // Keep object until the end of the request
$prof = new ExcimerProfiler();
$prof->setEventType(EXCIMER_REAL);
$prof->setPeriod(5); // every N seconds
$prof->setPeriod(0.2); // every N seconds
$prof->setMaxDepth(250);
$prof->setFlushCallback(function ($log) {
error_log("Logged profile", 0);
file_put_contents('/tmp/profles-ramfs/excimer-traces.log', $log->formatCollapsed(), FILE_APPEND | LOCK_EX);
}, 1);
$prof->start();