Skip to content

test: add a script that measures the app's CPU with sample data - #109

Merged
yogeshprasad098 merged 1 commit into
mainfrom
test/measure-cpu
Nov 27, 2026
Merged

yogeshprasad098 merged 1 commit into
mainfrom
test/measure-cpu

Conversation

@yogeshprasad098

@yogeshprasad098 yogeshprasad098 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Refs #90

The CPU problems in #90 showed up only after release, on the installed app. This adds scripts/measure-cpu.sh to catch them first. It builds the Debug app, runs it with --demo --live-readings, and prints the CPU of Chargectl and the window server for each dashboard page in front, the window in the background and the window closed.

It never takes the keyboard or moves the mouse. Two debug-only launch arguments make that possible: --background shows windows without making the app active, on the Mac's own screen when another display is connected, and --appear-active draws the dashboard as if Chargectl were in front, so the in-front cost is measured without focus. CONTRIBUTING and AGENTS.md say to run it after dashboard or menu bar changes and before a release.

Review focus

Dashboard.show returns early in --background mode, after orderFrontRegardless. Both arguments are read only in Debug builds; Release builds ignore them.

Testing

Tested on an M3 MacBook Air with an external display, macOS 27.2.1. Run on main (the Core Animation fix from #108) while I kept working on the other display. The window opened on the built-in screen, the front app stayed mine throughout (checked with lsappinfo front every 2 s), and the test app quit at the end:

Chargectl 0.3.2, 12 s per state
                            Chargectl   WindowServer
not running                                     8.3%
overview, in front               5.3%          41.6%
control, in front                1.9%          41.6%
history, in front                6.9%          41.5%
logs, in front                   0.6%          41.6%
settings, in front               2.2%          41.6%
overview, in background          7.9%          25.0%
window closed                    0.2%          25.0%
memory                         131 MB

The Chargectl column matches a run with the app really in front (5.9, 1.4, 6.2, 0.5, 2.3%). The WindowServer column counts every app on both screens, so it moved with what else was open; CONTRIBUTING says to read it only as a rough guide. ./scripts/check.sh passes; shellcheck -x -S warning is clean.

  • CHANGELOG.md has an entry under Unreleased saying what a user now sees, or nothing user-visible changed.
  • Docs are updated, or the change needs none.
  • A breaking change has ! in the title and the migration above.

The CPU problems in #90 were found only after release, on the installed
app. scripts/measure-cpu.sh catches them before one: it builds the Debug
app, runs it with --demo --live-readings, and prints the CPU of the app
and the window server for each dashboard page in front, the window in
the background and the window closed.

It never takes the keyboard or moves the mouse. Two debug-only launch
arguments make that possible: --background shows windows without
activating the app, on the Mac's own screen when another display is
connected, and --appear-active draws the dashboard as if it were in
front. CONTRIBUTING and AGENTS.md say to run it after dashboard changes
and before a release.

Refs #90

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation area: dashboard The Chargectl window and the setup window area: ci CI, the check scripts and the build setup labels Nov 27, 2026
@yogeshprasad098
yogeshprasad098 merged commit e0fb1c8 into main Nov 27, 2026
9 checks passed
@yogeshprasad098
yogeshprasad098 deleted the test/measure-cpu branch November 27, 2026 01:34
yogeshprasad098 added a commit that referenced this pull request Nov 27, 2026
The CPU problems in #90 were found only after release, on the installed
app. scripts/measure-cpu.sh catches them before one: it builds the Debug
app, runs it with --demo --live-readings, and prints the CPU of the app
and the window server for each dashboard page in front, the window in
the background and the window closed.

It never takes the keyboard or moves the mouse. Two debug-only launch
arguments make that possible: --background shows windows without
activating the app, on the Mac's own screen when another display is
connected, and --appear-active draws the dashboard as if it were in
front. CONTRIBUTING and AGENTS.md say to run it after dashboard changes
and before a release.

Refs #90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI, the check scripts and the build setup area: dashboard The Chargectl window and the setup window documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant