MobDev.Bench.Summary (mob_dev v0.3.28)

Copy Markdown View Source

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

Summary

Functions

Compute summary metrics for a bench CSV.

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

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

Types

metrics()

@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()) => 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()]
}

Functions

from_csv(path)

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

Compute summary metrics for a bench CSV.

from_rows(rows)

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

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

pretty(m)

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

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