Skip to content

iPhone frame-rate counter: heat and battery time left - #2612

Open
Mars-Mah3r wants to merge 3 commits into
seedds:mainfrom
Mars-Mah3r:ios-counter-heat-battery
Open

Mars-Mah3r wants to merge 3 commits into
seedds:mainfrom
Mars-Mah3r:ios-counter-heat-battery

Conversation

@Mars-Mah3r

@Mars-Mah3r Mars-Mah3r commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

A shorter redo of #1976. The counter reads:

60 fps · Busy
75% · 1h20 left
  • Heat: NSProcessInfo.thermalState with plain names: nominal → Normal, fair → Busy, serious → Throttling, critical → Overheat.
  • Battery: the percentage in 1 % steps, as the status bar shows it, from IOKit's power sources (looked up by name with dlsym, since they are in the iOS runtime but not its SDK). If the sandbox refuses them it uses UIDevice.batteryLevel, which moves in 5 % steps on current iOS. The log line frame-rate counter on (battery in … steps) says which one is in use.
  • Time left: measured from the first step down to the latest step. It shows … until then, and charging while plugged in. Charging, a level that goes up, or time in the background starts the measurement again.
  • Toggle: the second line is the launcher's Heat and battery row (DM_SHOW_HEAT_BATTERY, off by default), right under Frame-rate counter and drawn only while it is on. Off, the counter is 60 fps alone, as before. The in-game menu switches it at once.
  • The timer runs in the common run loop modes, so the label keeps updating while a touch is held.

Checked: compile_check.py (262 files, 0 failed); test_launcher_settings, test_player_env, test_settings, test_env_switches, test_docs.
Not checked: an iPhone. Still to find out on a phone: whether IOKit's power sources answer inside the app sandbox.

…he play time it leaves: "60 fps · Busy" over "75% · 1h20 left". The heat is NSProcessInfo's thermal state named for what it means (nominal, fair, serious, critical → Normal, Busy, Throttling, Overheat); the percentage comes from IOKit's power sources in 1 % steps, as the status bar shows it, or from UIDevice's 5 % steps when those are refused; the time is measured from the first step down to the latest, again after charging or the background. The label's timer runs in the common run loop modes, so it keeps updating while a touch is tracked (replaces PR seedds#1976)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added ios The iPhone and iPad app (dm/ios) docs Documentation labels Nov 13, 2026
… Heat and battery (DM_SHOW_HEAT_BATTERY, off by default) sits under Frame-rate counter and is drawn only while the counter is on (needs=DM_SHOW_FPS=1); without it the counter is the frame rate alone, as before. The in-game menu turns it on and off at once, and turning it on starts the battery's measurement again

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… DM_SHOW_HEAT_BATTERY and main's DM_SIX_DELAY

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation ios The iPhone and iPad app (dm/ios) tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants