cpu() Apple Silicon M1 cores
This commit is contained in:
parent
e840ed91b4
commit
a465449fa4
@ -175,6 +175,8 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
|
||||
| | governor | X | | | | | e.g. 'powersave' |
|
||||
| | cores | X | X | X | X | | # cores |
|
||||
| | physicalCores | X | X | X | X | | # physical cores |
|
||||
| | efficiencyCores | | | X | | | # efficiancy cores (ARM only) |
|
||||
| | performanceCores | | | X | | | # performance cores (ARM only) |
|
||||
| | processors | X | X | X | X | | # processors |
|
||||
| | socket | X | X | | X | | socket type e.g. "LGA1356" |
|
||||
| | vendor | X | X | X | X | | vendor ID |
|
||||
|
||||
@ -155,6 +155,26 @@
|
||||
<td></td>
|
||||
<td># physical cores</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>efficiencyCores</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td># efficiency cores (ARM only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>performanceCores</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td># performance cores (ARM only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>processors</td>
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
const os = require('os');
|
||||
const exec = require('child_process').exec;
|
||||
const execSync = require('child_process').execSync;
|
||||
const fs = require('fs');
|
||||
const util = require('./util');
|
||||
|
||||
@ -432,7 +433,12 @@ function getCpu() {
|
||||
const countCores = util.getValue(lines, 'hw.physicalcpu_max');
|
||||
const countThreads = util.getValue(lines, 'hw.ncpu');
|
||||
if (os.arch === 'arm64') {
|
||||
const clusters = execSync('ioreg -c IOPlatformDevice -d 3 -r | grep cluster-type').toString().split('\n');
|
||||
const efficiencyCores = clusters.filter(line => line.indexOf('"E"') >= 0).length;
|
||||
const performanceCores = clusters.filter(line => line.indexOf('"P"') >= 0).length;
|
||||
result.socket = 'SOC';
|
||||
result.efficiencyCores = efficiencyCores;
|
||||
result.performanceCores = performanceCores;
|
||||
}
|
||||
if (countProcessors) {
|
||||
result.processors = parseInt(countProcessors) || 1;
|
||||
|
||||
2
lib/index.d.ts
vendored
2
lib/index.d.ts
vendored
@ -73,6 +73,8 @@ export namespace Systeminformation {
|
||||
governor: string;
|
||||
cores: number;
|
||||
physicalCores: number;
|
||||
efficiencyCores?: number;
|
||||
performanceCores?: number;
|
||||
processors: number;
|
||||
socket: string;
|
||||
cache: CpuCacheData;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user