# Tracing Tutorial

`EventTracer` enables low-overhead instrumentation without formatting text.

## Choosing Capacity
Pick a capacity `N` that fits your memory budget. Larger buffers store more events before overwriting older ones.

## Recording Events
```rust
use os_observatory::tracer::{EventTracer, EventId};
static TRACER: EventTracer<512> = EventTracer::new();

fn schedule_task(task_id: u64) {
    TRACER.record(read_cycle_counter(), EventId(1), task_id, 0);
}
```

## Exporting
```rust
let mut out = [EventRecord { ts: 0, id: EventId(0), payload0: 0, payload1: 0 }; 128];
let n = TRACER.snapshot(&mut out);
// Send `out[..n]` to your host over debug channel
```

## Interpreting Records
- `ts`: your timestamp units
- `id`: classify event kind
- `payload0/1`: attach relevant context (addresses, counters, ids)

