How to profile a PHP shell script app or worker using Blackfire -


i noticed when have endless worker cannot profile php shell scripts. because when it's killed doesn't send probe.

what changes shall do?

when trying profile worker running endless loop. in case have manually edit code either remove endless loop or instrument code manually call close() method of probe (https://blackfire.io/doc/manual-instrumentation).

that's because data sent agent when close() method called (it called automatically @ end of program unless killed it).

you can manually instrument code using blackfireprobe class comes bundled blackfire's probe:

// probe main instance $probe = blackfireprobe::getmaininstance(); // start profiling code $probe->enable();  // calling close() instead of disable() stops profiling , forces  collected data sent blackfire:  // stop profiling // send result blackfire $probe->close(); 

as auto-instrumentation, profiling active when code run through companion or blackfire cli utility. if not, calls converted noops.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -