# callsight

> Exact per-call timing for the C/C++ code you choose — and zero cost for the code you don't. One config file picks what gets instrumented at compile time; everything else emits no hook at all. No source changes.

URL: https://harshith.in/projects/callsight/
Author: Harshith Sunku (Staff Engineer) — https://harshith.in/about/
Source: https://github.com/harshithsunku/callsight
Live: https://harshithsunku.github.io/callsight/
Stack: C, C++, Python, GCC, Make, CMake

Profiling a large C/C++ codebase usually forces a bad trade: sample it and miss the
rare-but-slow path, or instrument everything and drown in millions of events per
second. callsight moves that decision to **compile time**. A `trace.config` next to the
code names the files, folders, or call subtrees to trace; `callsight flags` turns it into
`-finstrument-functions` plus matching exclude lists, so selected functions get
entry/exit hooks and everything else gets no instruction at all.

The runtime appends 32-byte events to per-thread buffers — no locks, no malloc, no I/O
on the hot path — timestamped from the invariant cycle counter (`rdtsc` on x86-64,
`cntvct_el0` on aarch64). Because every selected call is timed, the p50/p99/max numbers
are measurements, not estimates.

`callsight analyze` streams the traces and exports a per-function table, folded stacks
for flame graphs, Chrome/Perfetto traces, hot call sites, or JSON. `callsight diff`
compares two runs and fails a CI job on a regression, optionally keyed on
instructions-per-call from hardware counters instead of noisy wall time. Capture is
bounded by default — size caps, a ring-buffer "flight recorder" mode, and an in-process
summary mode — so a long run can't fill the disk. The CLI is pure-stdlib Python, published
on PyPI.
