Coz profiles native binaries and ranks code lines by predicted throughput or latency impact using causal profiling experiments instead of classic hot-spot counts alone.
Overview
Coz is a profiler aimed at C, C++, and Rust programs that highlights code whose optimization is most likely to improve overall performance. It uses causal profiling, running controlled experiments that estimate how speeding up a region would change throughput or latency at declared progress points.
Users build binaries with debug symbols, mark progress points with provided macros or optional AI-suggested placements, and launch workloads through the coz CLI. Profiles can be viewed in a browser-based plotter that also offers optional LLM-assisted optimization hints from several providers.
Pre-built packages exist for common Linux distributions and macOS, with Python required alongside. Linux relies on perf_event_open sampling; macOS uses Apple's kperf framework and may need elevated privileges. Coz supports throughput profiling at a single progress marker and latency profiling between paired begin and end markers.
The tool does not target interpreted languages such as Python or Ruby without JIT debug information, though stripped binaries can still resolve symbols similarly to gdb.
Key features
- Causal profiling experiments
- Throughput and latency progress points
- Browser profile viewer with coz plot
- Optional LLM optimization suggestions
- coz suggest-points macro placement helper
- Pre-built Linux and macOS packages
- CMake integration via find_package
- Benchmark suite for trials
Use cases
- Choosing which functions to optimize first
- Measuring latency between transaction boundaries
- Performance work on multithreaded native services
- Teaching causal versus traditional sampling profiles
- Exploring progress-point placement with suggest-points