How longxinh/xhprof works
XHProf profiles PHP execution through a native extension, stores run data, then presents hierarchical reports in a browser. The main path is enable/profile, stop and obtain metrics, persist a run, and inspect it; reports also support run comparisons, aggregation, call graphs, and function lookup. The README documents sampling and optional SQL/cURL trace details. Some subsystem links rely on documented capabilities and filenames because their implementations were not sampled.
Main entry points: xhprof.c Profiler Extension · index.php Report Entry · xhprof_runs.php Run Storage API · callgraph.php Call Graph
Components 15
Profiling
- Profiler Extension
extension/xhprof.c - Profile Metrics
extension/xhprof.c
Run Data
- Run Storage API
xhprof_lib/utils/xhprof_runs.php - Run Files
Analysis
- Metric Analysis
xhprof_lib/utils/xhprof_lib.php - Call Graph
xhprof_html/callgraph.php - Graph Utilities
xhprof_lib/utils/callgraph_utils.php
Report UI
- Report Entry
xhprof_html/index.php - Report Renderer
xhprof_lib/display/xhprof.php - Function Lookup
xhprof_html/typeahead.php - Lookup UI
xhprof_lib/display/typeahead_common.php
Other components
- PHP Application
- SQL Workload
- HTTP Workload
- Browser User
Connections 17
- PHP Application → Profiler Extension: enables profiling
- Profiler Extension → Profile Metrics: collects metrics
- PHP Application → Profiler Extension: stops profiling
- Profiler Extension → PHP Application: returns metrics
- Profiler Extension → Run Storage API: provides run data
- Run Storage API → Run Files: writes runs
- Run Files → Run Storage API: reads runs
- Browser User → Report Entry: requests report
- Report Entry → Run Storage API: loads runs
- Report Entry → Report Renderer: renders report
- Report Renderer → Metric Analysis: analyzes metrics
- Report Entry → Call Graph: requests graph
- Call Graph → Graph Utilities: builds graph
- Browser User → Function Lookup: requests lookup
- Function Lookup → Lookup UI: uses lookup logic
- Profiler Extension → SQL Workload: traces SQL calls
- Profiler Extension → HTTP Workload: traces HTTP calls