✨ Add machine.cpu resource with correct socket/core reporting#6946
Merged
✨ Add machine.cpu resource with correct socket/core reporting#6946
Conversation
processorCount now reports physical CPU packages (sockets) instead of logical thread count. Manufacturer names are normalized (GenuineIntel → Intel, Apple prefix stripped from model on macOS). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
68c5e9b to
92cb623
Compare
92cb623 to
0884672
Compare
- Add getCpuInfoFreeBSD using sysctl hw.model and kern.smp.cores - Add getCpuInfoAIX using prtconf output parsing - Extract normalizeManufacturer helper: GenuineIntel→Intel, AuthenticAMD→AMD - Apply normalizeManufacturer to Linux and Windows paths - Add tests for AMD Linux, FreeBSD, and AIX Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0884672 to
93d3f8a
Compare
chris-rock
reviewed
Mar 17, 2026
providers/os/resources/os.lr
Outdated
| } | ||
|
|
||
| // CPU information | ||
| machine.cpu @defaults("manufacturer model processorCount cores") { |
Member
There was a problem hiding this comment.
I think we want machine.cpus as default as some systems can bundle multiple together. Therefore we should expose the logical cpus as /proc/cpuinfo does
Member
Author
There was a problem hiding this comment.
I renamed cores to coreCount so we can add a cores field in the future that includes all the individual cores
| address sizes : 48 bits physical, 48 bits virtual | ||
| power management: | ||
|
|
||
| processor : 1 |
Member
There was a problem hiding this comment.
I think we want to expose the every "logical CPU" as the model and vendors can differ
Member
Author
There was a problem hiding this comment.
That would be in the cores field in the future if we need it on arm platforms
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
machine.cpuresource with fields:manufacturer,model,processorCount,coresprocessorCountreports physical CPU packages (sockets), not logical threadscoresreports physical CPU cores@defaults("manufacturer model processorCount cores")for clean default outputGenuineIntel→Intel,AuthenticAMD→AMDvia sharednormalizeManufacturer()helper/proc/cpuinfowith physical_id/core_id deduplicationsysctl(brand string + hw.physicalcpu)Win32_Processorvia PowerShellsysctl(hw.model + kern.smp.cores)prtconffor model +lsdev -Cc processorfor physical core countpsrinfo -pvfor sockets, cores, and modelTest plan
mql run local -c "machine.cpu{*}"🤖 Generated with Claude Code