How noisebynorthwest/php-spx works
SPX is a PHP profiling extension. A CLI environment setting or HTTP request configuration enables profiling; the extension hooks PHP execution, collects call and metric data, then emits a flat report or stores a full report for the bundled web UI’s report listing and analysis. The principal runtime stages are PHP integration, configuration and hook dispatch, profiling/metric collection, and report delivery. Source excerpts are incomplete, so some README-documented UI and report-storage links are shown as unverified rather than asserted as inspected calls.
Main entry points: php_spx.c SPX extension · spx_profiler_tracer.c Call tracer · spx_reporter_fp.c Flat report · spx_metric.c Metric collection
Components 18
PHP integration
- SPX extension
src/php_spx.c - Profile configuration
src/spx_config.c - PHP hooks and API
src/spx_php.c
Profile capture
- Sampling profiler
src/spx_profiler_sampler.c - Call tracer
src/spx_profiler_tracer.c - Metric collection
src/spx_metric.c
Reporting
- Flat report
src/spx_reporter_fp.c - Full report
src/spx_reporter_full.c - Trace report
src/spx_reporter_trace.c - HTTP control and UI
src/php_spx.c - Report files
Runtime support
- Process statistics
src/spx_resource_stats-linux.c - Output streams
src/spx_output_stream.c - Value and table formatting
src/spx_fmt.c - Function table map
src/spx_hmap.c
Other components
- CLI script
- Browser session
- PHP runtime
Connections 19
- CLI script → SPX extension: enables profiling
- Browser session → SPX extension: configures request
- PHP runtime → SPX extension: runs extension
- SPX extension → Profile configuration: loads settings
src/php_spx.c - SPX extension → PHP hooks and API: hooks execution
src/php_spx.c - SPX extension → Sampling profiler: selects profiler
- SPX extension → Call tracer: selects profiler
- Call tracer → Metric collection: collects metrics
src/spx_profiler_tracer.c - Metric collection → Process statistics: reads process stats
src/spx_metric.c - Call tracer → Function table map: indexes functions
src/spx_profiler_tracer.c - Call tracer → Flat report: notifies events
- Call tracer → Full report: notifies events
- Call tracer → Trace report: notifies events
- Flat report → Output streams: prints report
src/spx_reporter_fp.c - Flat report → Value and table formatting: formats values
src/spx_reporter_fp.c - Full report → Report files: writes report data
- Trace report → Output streams: writes trace
- HTTP control and UI → Report files: lists and serves reports
- Browser session → HTTP control and UI: views analysis