Comments (5)
Hm, so these cores are different than normal? Is there an API to query them? We'd need more info to answer the question properly, I think.
from num_cpus.
I thought the best way for me to learn more is to look at sysinfo, which appears to use a sysctl
API.
Looking at it, there isn't anything obvious showing the amount of high performance (or high efficiency) cores for that matter:
sysctl -a | rg cpu
kern.cpu_checkin_interval: 4000
hw.ncpu: 8
hw.activecpu: 8
hw.physicalcpu: 8
hw.physicalcpu_max: 8
hw.logicalcpu: 8
hw.logicalcpu_max: 8
hw.cputype: 16777228
hw.cpusubtype: 2
hw.cpu64bit_capable: 1
hw.cpufamily: 458787763
hw.cpusubfamily: 2
machdep.cpu.cores_per_package: 8
machdep.cpu.core_count: 8
machdep.cpu.logical_per_package: 8
machdep.cpu.thread_count: 8
machdep.cpu.brand_string: Apple M1
Another bunch of flags yields nothing very telling either: sysctl hw
sysctl hw
hw.ncpu: 8
hw.byteorder: 1234
hw.memsize: 8589934592
hw.activecpu: 8
hw.physicalcpu: 8
hw.physicalcpu_max: 8
hw.logicalcpu: 8
hw.logicalcpu_max: 8
hw.cputype: 16777228
hw.cpusubtype: 2
hw.cpu64bit_capable: 1
hw.cpufamily: 458787763
hw.cpusubfamily: 2
hw.cacheconfig: 8 1 1 0 0 0 0 0 0 0
hw.cachesize: 3613523968 65536 4194304 0 0 0 0 0 0 0
hw.pagesize: 16384
hw.pagesize32: 16384
hw.cachelinesize: 128
hw.l1icachesize: 131072
hw.l1dcachesize: 65536
hw.l2cachesize: 4194304
hw.tbfrequency: 24000000
hw.packages: 1
hw.osenvironment:
hw.ephemeral_storage: 0
hw.use_recovery_securityd: 0
hw.use_kernelmanagerd: 1
hw.serialdebugmode: 0
hw.optional.floatingpoint: 1
hw.optional.watchpoint: 4
hw.optional.breakpoint: 6
hw.optional.neon: 1
hw.optional.neon_hpfp: 1
hw.optional.neon_fp16: 1
hw.optional.armv8_1_atomics: 1
hw.optional.armv8_crc32: 1
hw.optional.armv8_2_fhm: 1
hw.optional.armv8_2_sha512: 1
hw.optional.armv8_2_sha3: 1
hw.optional.amx_version: 2
hw.optional.ucnormal_mem: 1
hw.optional.arm64: 1
hw.targettype: J313
There is only this one line showing hw.optional.watchpoint: 4
, and it might take another Apple hardware release to know if that does indeed change with the amount of high performance or high-efficiency cores.
from num_cpus.
To make it a little less specific, a point validly criticised in the linked sysinfo
issue, here is the announced Intel Alder Lake CPU which introduces the concept of 'big' and 'small' cores.
Let's see what AMD will do.
from num_cpus.
With Big Sur Monterey on an M1 Pro, I get this output now:
ยป sysctl -a | rg cpu
kern.cpu_checkin_interval: 4000
kern.sched_rt_avoid_cpu0: 0
hw.ncpu: 10
hw.activecpu: 10
hw.perflevel0.cpusperl2: 4
hw.perflevel0.logicalcpu: 8
hw.perflevel0.logicalcpu_max: 8
hw.perflevel0.physicalcpu: 8
hw.perflevel0.physicalcpu_max: 8
hw.perflevel1.cpusperl2: 2
hw.perflevel1.logicalcpu: 2
hw.perflevel1.logicalcpu_max: 2
hw.perflevel1.physicalcpu: 2
hw.perflevel1.physicalcpu_max: 2
hw.cpu64bit_capable: 1
hw.cpufamily: 458787763
hw.cpusubfamily: 4
hw.cpusubtype: 2
hw.cputype: 16777228
hw.logicalcpu: 10
hw.logicalcpu_max: 10
hw.physicalcpu: 10
hw.physicalcpu_max: 10
machdep.cpu.brand_string: Apple M1 Pro
machdep.cpu.core_count: 10
machdep.cpu.cores_per_package: 10
machdep.cpu.logical_per_package: 10
machdep.cpu.thread_count: 10
Should be able to get the values from hw.perflevel0
and hw.perflevel1
from num_cpus.
That's great, it looks like they have improved the output on Monterey, which the minimum OS for the M1 Pro CPUs.
Now it looks like the perflevelN
key can be used to differentiate the core counts.
from num_cpus.
Related Issues (20)
- Returns 13 cores on AWS 16 core instance HOT 3
- Returning `NonZeroUsize` HOT 3
- How to know the number of big and little cores in ARM big.LITTLE architecture?
- Should hyperthreads be counted when disabled? HOT 2
- Deprecate library? HOT 6
- Is num_cpus impacted by lxcfs #469?
- Number of CPUs detected incorrectly on systems using cgroups v2 HOT 2
- Feature Request: cgroupv2 support HOT 3
- Request: make a new release with updated `hermit-abi` dep HOT 2
- Use rustix instead of libc
- num_cpus::get()=0 on mipsel-unknown-linux-gnu HOT 10
- Re-enable Fuchsia CI target HOT 1
- Make a 1.10.1 release HOT 1
- Be more optimistic when querying on Windows? HOT 3
- Test/document cgroups behavior HOT 1
- returns 48 cores for 96 core windows machine HOT 3
- get_physical() returning wrong value with AMD 2970WX
- Add call to check total number of CPUs? HOT 6
- Incorrect count return by `get_num_physical_cpus` in my linux laptop. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from num_cpus.