# `MobDev.Bench.Summary`
[🔗](https://github.com/genericjam/mob_dev/blob/master/lib/mob_dev/bench/summary.ex#L1)

Post-run analysis of a bench CSV log.

Reads a `MobDev.Bench.Logger` CSV and produces a summary map with
metrics that tell you whether the bench measurement is trustworthy:

- `total_samples` — how many polls completed
- `successful_samples` — those that produced a battery reading
- `success_rate` — fraction (0.0..1.0)
- `reconnect_count` — number of times we transitioned :unreachable / :alive_*_only → :alive_rpc
- `longest_gap_sec` — longest interval between successful battery reads
- `state_durations` — total time (sec) spent in each reachability state
- `screen_off_duration_sec` — time the screen was off
- `screen_on_duration_sec` — time the screen was on
- `start_battery`, `end_battery`, `drain_pct` — first and last successful reads
- `effective_rate_pct_per_hour` — drain extrapolated to per-hour

# `metrics`

```elixir
@type metrics() :: %{
  total_samples: non_neg_integer(),
  successful_samples: non_neg_integer(),
  success_rate: float(),
  reconnect_count: non_neg_integer(),
  longest_gap_sec: float(),
  state_durations: %{required(atom()) =&gt; float()},
  screen_off_duration_sec: float(),
  screen_on_duration_sec: float(),
  start_battery: integer() | nil,
  end_battery: integer() | nil,
  drain_pct: integer() | nil,
  effective_rate_pct_per_hour: float() | nil,
  taint_warnings: [String.t()]
}
```

# `from_csv`

```elixir
@spec from_csv(Path.t()) :: metrics()
```

Compute summary metrics for a bench CSV.

# `from_rows`

```elixir
@spec from_rows([map()]) :: metrics()
```

Compute summary metrics from already-parsed rows. Useful for tests.

# `pretty`

```elixir
@spec pretty(metrics()) :: String.t()
```

Render a summary as a human-readable multi-line string.

---

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