# `Juggernaut.View.Profile`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/view/profile.ex#L1)

Where a run's time went (`mix juggernaut.profile`, design notes §3): the phase clocks,
the duration of mutant jobs by test selection (p50, p90, p99, max), the fallbacks to a
whole file, the whole suite or the boot lane and the functions that caused them, the
tests that cost the most across mutant jobs, worker utilisation and recycles, the
results reused (recorded time), the selection misses found by reconfirmation, and the
boot set: how many of its mutants a warm worker killed (strikes for the boot lane), how
many the boot lane ran and how many of those a strike killed, at what concurrency and
why (as the run recorded it, `Juggernaut.Run`).

Every duration is measured by the run, except the reused results', which were recorded
by the run each came from and are kept apart: they are not in the percentiles, the test
costs or the worker times. Percentiles use the nearest-rank method.

The JSON document is `{"format": 1, "kind": "profile", ...}` with the same sections.

# `t`

```elixir
@type t() :: %{
  run_id: String.t(),
  wall_ms: non_neg_integer() | nil,
  phases: [{String.t(), non_neg_integer()}],
  unphased_ms: non_neg_integer() | nil,
  selection: [map()],
  fallbacks: [map()],
  tests: %{top: [map()], total: non_neg_integer()},
  workers: [map()],
  recycles: [map()],
  reused: %{results: non_neg_integer(), recorded_ms: non_neg_integer()},
  misses: [String.t()],
  boot_set: Juggernaut.Run.boot_lane() | nil,
  boot_parts: [map()]
}
```

The profile of a run, the data both formats render.

# `boot_set_rows`

```elixir
@spec boot_set_rows(Juggernaut.Run.boot_lane() | nil) :: [String.t()]
```

The boot set's lines for people: killed warm, run in the boot lane, struck there.

# `profile`

```elixir
@spec profile(Juggernaut.Run.t()) :: t()
```

The profile of `run`.

# `render`

```elixir
@spec render(:human | :json, Juggernaut.Run.t()) :: iodata()
```

The profile of `run` in `format` (`:human` or `:json`).

# `stats`

```elixir
@spec stats([non_neg_integer()]) :: map()
```

Count, nearest-rank p50/p90/p99, max and total of `durations` (non-empty).

---

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