# `Excessibility.TelemetryCapture.Analyzers.Performance`
[🔗](https://github.com/lessthanseventy/excessibility/blob/v0.18.1/lib/telemetry_capture/analyzers/performance.ex#L1)

Analyzes performance patterns across timeline events.

Detects:
- Slow events using adaptive thresholds (> mean + 2std_dev)
- Bottlenecks (events taking >50% of total time)
- Very slow events (over an absolute ceiling, 1000ms by default)

Uses data from the Duration enricher (event_duration_ms) to identify
performance issues.

## What this does *not* catch

This is a **relative** signal, not a latency budget. Findings fire on
outliers (an event much slower than the rest of the run), on the single
event that dominates total time, and on anything over the absolute ceiling.
**Uniformly slow code is invisible to it:** if every event takes a sluggish
400ms, nothing is an outlier, nothing dominates the total, and nothing
crosses the ceiling — so the section stays green.

That is deliberate. These durations come from a test run (ExUnit +
`Ecto.Sandbox` + cold first-mounts), so absolute timings are unreliable and
an absolute per-event threshold would mostly flag a slow CI box. Treat a
green performance section as "no relative regression in this run", not as
"fast". If your test timings are representative and you want an absolute
budget, lower the ceiling with `config :excessibility, slow_event_ms: 400`.

## Algorithm

1. Calculate baseline stats (mean, std deviation)
2. Detect slow events:
   - Warning: Duration > mean + 2std_dev
   - Critical: Duration > `:slow_event_ms` (default 1000ms) OR > mean + 3std_dev
3. Detect bottlenecks: Events taking >50% of total time

## Output

Returns findings and statistics:

    %{
      findings: [
        %{
          severity: :warning,
          message: "Slow event (250ms, 5x average)",
          events: [3],
          metadata: %{duration_ms: 250, multiplier: 5.0}
        }
      ],
      stats: %{
        min_duration: 10,
        max_duration: 250,
        avg_duration: 50,
        total_duration: 500
      }
    }

# `analyze`

# `default_enabled?`

# `name`

# `requires_enrichers`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
