# Reports, tools and agents

`profiler.report()` returns plain JSON about the frames in the buffer (ten seconds by default). This one is from a debuff game on a 165 Hz display:

```json
{
  "frames": 558,
  "seconds": 3.47,
  "fps": 160.88,
  "budgetMs": 9.09,
  "displayIntervalMs": 6.06,
  "intervalMs": { "p50": 6.1, "p95": 6.2, "p99": 12.1, "max": 30.3 },
  "cpuMs": { "p50": 0.2, "p95": 0.6, "max": 1.4 },
  "hitches": 3,
  "causes": { "unknown": 2, "script": 1 },
  "worst": [],
  "spans": { "update": 0.04, "render": 0.09 },
  "perFrame": { "draws": 1, "uploads": 1, "uploadBytes": 0 },
  "overheadMs": 0.053,
  "support": { "attribution": true, "heap": true, "contexts": true },
  "warnings": []
}
```

- `intervalMs` is what players feel. Watch p95 and p99, not the average.
- `cpuMs` is what your frame code costs.
- `worst` holds up to 10 verdicts, slowest first.
- `support` says what this browser reports, so you know how much to trust the causes.
- `warnings` says what Myaku couldn't see. **Check it before trusting a quiet report.**

## Warnings

Myaku would rather tell you it's blind than show a healthy-looking graph it can't vouch for. `profiler.warnings()`, the report's `warnings` and the overlay all list:

- **No frames recorded.** The game kept its own reference to `requestAnimationFrame` from before Myaku loaded. Load Myaku first.
- **No canvas context seen.** The game created its context before Myaku loaded, so draws, uploads and compiles aren't counted. Load Myaku first.
- **More than 16 span names.** The rest are added up under `other`, not dropped.
- **Heap too coarse.** Some browsers report the heap rarely or in big steps, which can't show garbage collection. Myaku checks that readings actually change. When they don't, `support.heap` is `false` and `unknown` verdicts say GC can't be ruled out.

## From browser automation

Myaku exposes itself as `window.__MYAKU__`, so Playwright or Puppeteer can read it after playing:

```ts
await page.goto("http://localhost:5173");
await page.waitForTimeout(5000);
const report = await page.evaluate(() => window.__MYAKU__.report());
expect(report.intervalMs.p95).toBeLessThan(20);
```

## From coding agents

In debuff projects, the MCP server's `game_profile` tool returns the report from the running game, and the `explain-stutter` prompt walks an agent through it: read the worst verdicts, open the code they point at, fix it, and measure again.