Skip to content

MacOS Implementation - #5

Open
arturovilla wants to merge 4 commits into
usgraphics:masterfrom
arturovilla:master
Open

MacOS Implementation#5
arturovilla wants to merge 4 commits into
usgraphics:masterfrom
arturovilla:master

Conversation

@arturovilla

@arturovilla arturovilla commented Jun 10, 2024

Copy link
Copy Markdown

The project looked pretty cool on twitter so I thought i would give it a go for MacOS.

Fair warning I only had today and I couldn't get some things to work:
There are some code comments but I couldn't get CPU FREQ to work since Apple stopped supporting the sysctl -n hw.cpufrequency . Not even sure they dropped support for it but it doesn't work for Apple silicon machines,

I could maybe get it with powermetrics but that requires sudo and a time interval so I chose to let it go for now.

Hypervisor Vendor name is also missing best I could do it to see if the hypervisor was enabled.

Kinda tired so if you need me to delete some comments, write some readme, or think of another implementation just lmk.
SS_6A3A9LrQ_1127PM@2x

@x-t

x-t commented Jun 10, 2024

Copy link
Copy Markdown
./machine_report.sh: line 19: numfmt: command not found
Failed conversion of ``8 Jun 18:15 -'' using format ``%a %b %d %H:%M''
date: illegal time format
usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt]
            [-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]
            [[[[mm]dd]HH]MM[[cc]yy][.SS] | new_date] [+output_fmt]

Are you using GNU coreutils?

@arturovilla

Copy link
Copy Markdown
Author

Yeah , is that a deal breaker ? Maybe I should edit the readme to reflect that . not sure when I downloaded that but I guess it could have been included with homebrew?
Screenshot 2024-06-10 at 1 17 44 PM

./machine_report.sh: line 19: numfmt: command not found
Failed conversion of ``8 Jun 18:15 -'' using format ``%a %b %d %H:%M''
date: illegal time format
usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt]
            [-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]
            [[[[mm]dd]HH]MM[[cc]yy][.SS] | new_date] [+output_fmt]

Are you using GNU coreutils?

@x-t

x-t commented Jun 10, 2024

Copy link
Copy Markdown

Yeah , is that a deal breaker ? Maybe I should edit the readme to reflect that . not sure when I downloaded that but I guess it could have been included with homebrew? Screenshot 2024-06-10 at 1 17 44 PM

./machine_report.sh: line 19: numfmt: command not found
Failed conversion of ``8 Jun 18:15 -'' using format ``%a %b %d %H:%M''
date: illegal time format
usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt]
            [-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]
            [[[[mm]dd]HH]MM[[cc]yy][.SS] | new_date] [+output_fmt]

Are you using GNU coreutils?

Yeah, it does not work without GNU coreutils. numfmt(1) is not included in macOS, nor FreeBSD. Also the date(1) format for non-GNU coreutils differs. I also have homebrew installed, but I don't have GNU coreutils, you must've installed them by yourself. I attempted to fix both things, but I found out that percentages above 100% pretty much break the rendering of bars anyway, and I don't feel like fixing any of that.

@arturovilla

Copy link
Copy Markdown
Author

Dang sorry about that I tried to see the my Homebrew deps but it seems like I installed coreutils standalone , I attached the output as a txt maybe someone can let me know where I got these utils...
output.txt
@x-t

RealEmmettS referenced this pull request in QubeTX/qube-machine-report Apr 28, 2026
…erminal walk)

PR #5 partial — Windows polish from MASTER_PLAN.md. E.6 (admin RDP login
history) and C.13 (batched PowerShell fallback) deferred to a future
session.

- C.10/C.10b: Native battery via GetSystemPowerStatus (~1ms vs ~40ms WMI),
  with a 5-state output model — AC Power (>=95% on AC, no charging),
  X% (Charging), X% (Plugged in) (gaming-laptop case where peak GPU draw
  exceeds the brick wattage OR firmware-limited charging like ThinkPad
  battery longevity), X% (Discharging) / Critical / Low / Unknown when
  off AC. Replaces the v3.11.x output of "100% (Discharging (High))"
  (legacy WMI BatteryStatus enum was confusing).
- C.9: Native socket count via GetLogicalProcessorInformationEx
  (~3ms vs ~30ms WMI), two-call buffer-sizing pattern, walks
  variable-length SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX records via
  u32::from_le_bytes (alignment-safe).
- C.8: GPU enumeration prefers the registry path (already used by --fast)
  in full mode too, since {4d36e968-...} Display class only enumerates
  hardware adapters. Added filter_software_gpus() name-based filter as
  belt-and-suspenders. WMI/PowerShell remain as fallbacks. Simpler than
  the originally-planned full DXGI EnumAdapters1 COM impl (~25 LOC vs
  ~100 LOC).
- C.11: PowerShell 7+ detection via HKLM\SOFTWARE\Microsoft\PowerShellCore\
  InstalledVersions\<GUID>\SemanticVersion. Compared as semver
  (u64,u64,u64) tuples to avoid the "7.9.0" > "7.10.0" string-compare
  bug (caught in Codex review).
- C.12: Terminal parent-process walk via Toolhelp32 — recognizes Windows
  Terminal, WezTerm, Alacritty, VS Code, Cursor, Windsurf, Hyper, Tabby,
  Ghostty, Kitty, MinTTY, Claude Code, Antigravity. Cap 10 levels,
  intermediate hosts (conhost.exe / powershell.exe / pwsh.exe / cmd.exe
  / shells) are skipped to keep walking. Verified on this dev host:
  tr300.exe -> bash.exe -> claude.exe correctly resolves to "Claude Code".
- C.14: Verified COM/WMI is already structurally absent from --fast hot
  path (fast mode early-returns before any COMLibrary::new()). No source
  change needed.
- Codex review (GPT-5.5, high reasoning) caught two issues, both fixed
  before commit: alignment UB in the SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
  walk (replaced raw cast with u32::from_le_bytes), and string-compare
  ordering bug in PSCore version detection (replaced with parse_semver_tuple
  comparing as (u64, u64, u64) tuples).

winapi features: + winbase, errhandlingapi, winnt, tlhelp32,
processthreadsapi, handleapi.

Local gate: cargo fmt clean, cargo clippy --all-targets --workspace
-D warnings clean, 14/14 integration tests pass + 15 lib tests, release
build clean, --fast 7-run median 354ms (within 100ms of ~308ms v3.11
baseline, well under 1500ms CI gate).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
RealEmmettS referenced this pull request in QubeTX/qube-machine-report Apr 28, 2026
After tagging v3.13.0 (commit f34e981), bring the planning docs in sync
with reality.

MASTER_PLAN.md:
- "Last updated" 2026-04-27 -> 2026-04-28
- "Current version" 3.11.0 -> 3.13.0
- Shipped table expanded from 2 to 7 entries (v3.11.1, v3.12.0, v3.13.0
  plus the audit-fix and macos-13 drop intermediate commits)
- New tag-status section documenting the cargo-dist v0.31.0 installer
  regression on x86_64-apple-darwin + x86_64-unknown-linux-musl that
  blocks all release.yml runs from producing GitHub release artifacts
- "Live behavior changes" section expanded with v3.13.0 user-visible
  improvements (5-state battery, terminal walk recognizing Claude
  Code/Cursor/Windsurf/etc., PSCore detection, GPU registry-prefer)
- "Pending" rewritten: drops shipped PRs, adds task numbers (#54, #56,
  #58) for outstanding work
- "Recommended next steps" repointed to the cargo-dist fix as priority
  and PR #2/PR #3 as next-session targets
- PR #4/PR #4b/PR #5 implementation checklists updated with shipped
  status and plan deviations called out: C.4 used simpler filter-WMI
  approach instead of full GetAdaptersAddresses linked-list walk; C.8
  used registry-prefer + name-filter approach instead of full DXGI COM;
  C.10 extended into C.10b with 5+ states (user-requested gaming-laptop
  case); E.6 and C.13 deferred to task #58.
- Phasing & sequencing table updated with new commit shas and status

AGENTS.md:
- Bump stale "Current version: 3.9.0" to "Current version: 3.13.0"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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