HaikuBlog
TerminalTerminal
be_trace / Ku
Press Esc to go back

/projects/be_trace

Kernel observability for Haiku OS. Static tracepoints with per-CPU ring buffers, exposed as BMessages through native Haiku APIs.

Interactive Demo: Ku Trace Viewer

Ku — Kernel Observability for Haiku
Ku (句) — Static kernel tracepoints with per-CPU ring buffers, exposed as BMessages. No DTrace complexity. Just structured events flowing through the APIs Haiku already has.
0 events
Trace output will appear here...
Phase 1 Scope
✓ KernelRing buffer + /dev/ku device + KU_TRACE() macros (~1500 lines)✓ ProbesScheduler (switch/wake/block) + Port IPC (create/write/read) + Syscalls✓ Userlandlibku (C) + libku++ (BMessage API) + ku CLI tool○ Phase 2VFS/VM/Net probes, GUI viewer, Deskbar replicant, Lua scripting

Philosophy & Approach

The DTrace Way

Complex, specialized language (D), strict safety guarantees, massive monolithic kernel integration.

The Haiku Way

Simple static tracepoints, data exposed via BMessage for easy consumption by GUI tools. Build Deskbar replicants, full apps, or script with Hey.

Implementation Roadmap

1

Kernel Module + Ring Buffers

Per-CPU lock-free ring buffers with /dev/ku device node for userland access via read() and ioctl().

2

Core Probe Categories

Scheduler (switch/wake/block), Port IPC (create/write/read), and syscall entry/exit tracepoints.

3

Userland Libraries

libku (C API) and libku++ (BMessage-based C++ API with BMessenger delivery).

4

CLI Tool

ku watch for live streaming, ku stat for aggregate counters, ku list for available probes.

5

Extended Probes

VFS operations, VM paging, network stack events, and application-defined tracepoints.

6

GUI Viewer & Deskbar Replicant

Graphical trace viewer with filtering, timeline visualization, and a compact Deskbar widget.