It'd be more interesting if, instead, they could intercept PDO queries and add profiling to those, for example.
Still, free code is free code. I don't want to look down upon it, just that the utility for my case is limited.
Nowadays it would be necessary to also show the various Curl/API calls because they're so omnipresent and impactfull on PHP sites (as wait time and not CPU time)... But AFAIK it's pretty hard to intercept them in a generic way.
I see there's a wordpress-specific wpdb mechanism - though it just seems to report total time spent on queries, and the slowest query. Surely something like Query Monitor is a far better tool for that?
A tool that everyone should be aware of and using is php-spx - its absolutely glorious for performance profiling/investigation. xhgui is similar, but bulkier and (in my experience) less accurate/insightful.
"Query" does mean "HTTP request" in the summary. It's reported as "Hits" in the stats. Sorry for the incoherent wording ...
The SQL/wpdb support was added afterwards, and it shows because data is only collected but not used/displayed in the histograms.
Phptop is wayyy simpler and not even comparable to SPX, but you can install it in a few sec, use it 5min, uninstall it, and solve lots of common perf problem. That was my use case (it'as ancient code and I barely use it nowadays).
What do you use now?
127dot1•1d ago
tarjei_huse•1d ago
joshstrange•1d ago
zerodeux•22h ago
I'm the author, it's funny this thing pops up now, it was written +15 years ago and is barely maintained (but AFAKI still works).
The metrics collected are close to those from PHP-FPM (CPU user/sys, clock time, peak memory) + the wpdb hook because I had to profile lots of WP.
The most interesting part is the 'phptop' tool itself which actually parse the logs and make some useful histograms.
Its main force I think it's that it's very lightweight (500 lines of Perl, fast and efficient regexes), works everywhere (very old Perl will do), and gives results instantly. My usecase used to be : apt install phptop, wait (at least) 1min for data collection, get useful histogram. It's also obviously very easy to uninstall.
It does pollute the error log, but it's the most simple and universal data sink I could think of, and well it's a hack in the end.
Patches still welcome anyway :).
rthnbgrredf•1d ago
You can print the time, cpu and memory usage per request and build metrics based on these outputs. This can be done in any major cloud, with open source tooling and even with simple linux coretuils. One tool to visualize such metrics is Grafana.
zerodeux•22h ago