kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

Sampling profiler — kit prof (planned work)

Forward-looking design for kit prof, a host-native statistical CPU profiler. It reuses the interactive JIT debugger's host signal infrastructure (../DBG.md, DEBUG.md): SIGPROF fires on the debugger's worker thread, the handler walks the frame-pointer chain into a pre-allocated ring buffer and returns without parking — the one property that keeps sampling cheap and guest timing undisturbed — and PCs are symbolicated after the guest exits.

Nothing exists yet: no prof subcommand in driver/main.c, no src/dbg/prof.c, no on_sample field on KitDbgSignalOps. This document is the worklist for building it.

Scope — this is the sampling profiler, deliberately on the host-native substrate. It is one of two complementary profilers, and it is not being rebased onto the emulator. This one measures real wall/CPU time by statistically sampling natively-run kit code; the deterministic instruction-counting profiler (callgrind-style — exact, reproducible, any guest arch) lives on the emulator substrate (INSTRUMENT.md §9, §12.1). The two share a back-end (symbolication + folded / flat output), not a collector. See INSTRUMENT.md §9 for the perf-vs-callgrind split and the one-core-two-collectors factoring.

1. Public API (include/kit.h)

2. Library (src/dbg/prof.c, freestanding C11)

3. Host adapter (driver/env/posix_dbg.c and windows.c)

4. Driver (driver/cmd/prof.c)

Wired into the multi-call dispatch in driver/main.c:

5. Tests

6. Follow-ons (deferred)