Skip to content

Add Mac mini power monitoring - #11

Merged
EClinick merged 14 commits into
masterfrom
codex/mac-mini-power-stats
Jul 28, 2026
Merged

Add Mac mini power monitoring#11
EClinick merged 14 commits into
masterfrom
codex/mac-mini-power-stats

Conversation

@EClinick

@EClinick EClinick commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • detect legacy and current Mac mini models and show a server-focused live power experience
  • integrate every live reading into compact minute aggregates with exact energy, coverage bounds, and peak power
  • persist whole-system and per-app history atomically for Today, 1W, All, and app detail views, including a final termination flush
  • add a dedicated Mac mini Stats window backed by the same live snapshot and range semantics as the popover
  • keep the Mac mini popover at its intended height, top-align Stats rows, left-align the range tabs, and pad chart ranges so edge labels remain visible
  • use adaptive W, mW, Wh, and mWh formatting so positive readings never appear as false zeroes
  • keep development helper packaging and deterministic UI verification isolated from production builds

Why

Mac minis have no battery, so the battery-oriented path could not provide a useful current-power view. Server mode reports current metered CPU, GPU, and Neural Engine draw while accumulating gap-aware local history without sampling away short workloads.

Verification

  • DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make test — 244 tests across 33 suites passed with Xcode 26.6
  • ARCHS=arm64 make app-adhoc — app and embedded helper built, signed, and verified
  • native Xcode walkthrough — verified the full-height popover, top-aligned and scrollable Stats table, left-aligned range tabs, and unclipped chart labels
  • installed-app walkthrough — verified popover and Stats values against the SQLite store, range switching, refresh, live totals, and app-detail navigation
  • git diff --check — passed
  • three independent review rounds completed; all actionable findings addressed

Copilot AI review requested due to automatic review settings July 28, 2026 04:10
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
website Ignored Ignored Preview Jul 28, 2026 7:20pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8aa0983fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Juice/MacMiniPowerView.swift Outdated
bucketDuration: bucketDuration),
recordingSince: recordingSince,
bucketDuration: bucketDuration,
appTotals: try store.systemAppEnergyTotals(since: start, until: now))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include the first partial hour in All totals

When recording starts partway through an hour, recordingSince is the first minute-level power timestamp, while the corresponding app-energy bucket is keyed to the start of that hour. Passing start directly to systemAppEnergyTotals therefore excludes that entire first bucket via bucket_start >= since, so the All app ranking permanently omits up to an hour of energy and disagrees with app detail, which starts from the earliest app bucket. Align the app query start to the hour boundary or derive it from the earliest app-energy date.

Useful? React with 👍 / 👎.

Comment on lines +363 to +365
LineMark(
x: .value("Time", bucket.start),
y: .value("Average watts", bucket.averageWatts))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Break the Stats chart across monitoring gaps

When Juice is stopped long enough to leave empty buckets, SystemPowerAnalytics.buckets omits those buckets, but this LineMark places every remaining point in one series. The Mac mini Stats chart consequently draws a continuous line across unmonitored periods and visually invents coverage; the popover avoids this by assigning a new series segment after a bucket gap. Apply equivalent segmentation here so outages remain visible.

Useful? React with 👍 / 👎.

@EClinick
EClinick merged commit 737a4dd into master Jul 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants