cpu() Apple Silicon M1 mem
This commit is contained in:
parent
57d23559ed
commit
6c222d4dcc
@ -410,7 +410,7 @@ function getCpu() {
|
|||||||
cache: {}
|
cache: {}
|
||||||
};
|
};
|
||||||
if (_darwin) {
|
if (_darwin) {
|
||||||
exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency', function (error, stdout) {
|
exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily', function (error, stdout) {
|
||||||
let lines = stdout.toString().split('\n');
|
let lines = stdout.toString().split('\n');
|
||||||
const modelline = util.getValue(lines, 'machdep.cpu.brand_string');
|
const modelline = util.getValue(lines, 'machdep.cpu.brand_string');
|
||||||
const modellineParts = modelline.split('@');
|
const modellineParts = modelline.split('@');
|
||||||
@ -425,10 +425,10 @@ function getCpu() {
|
|||||||
result = cpuBrandManufacturer(result);
|
result = cpuBrandManufacturer(result);
|
||||||
result.speedmin = util.getValue(lines, 'hw.cpufrequency_min') ? (util.getValue(lines, 'hw.cpufrequency_min') / 1000000000.0).toFixed(2) : result.speed;
|
result.speedmin = util.getValue(lines, 'hw.cpufrequency_min') ? (util.getValue(lines, 'hw.cpufrequency_min') / 1000000000.0).toFixed(2) : result.speed;
|
||||||
result.speedmax = util.getValue(lines, 'hw.cpufrequency_max') ? (util.getValue(lines, 'hw.cpufrequency_max') / 1000000000.0).toFixed(2) : result.speed;
|
result.speedmax = util.getValue(lines, 'hw.cpufrequency_max') ? (util.getValue(lines, 'hw.cpufrequency_max') / 1000000000.0).toFixed(2) : result.speed;
|
||||||
result.vendor = util.getValue(lines, 'machdep.cpu.vendor');
|
result.vendor = util.getValue(lines, 'machdep.cpu.vendor') || 'Apple';
|
||||||
result.family = util.getValue(lines, 'machdep.cpu.family');
|
result.family = util.getValue(lines, 'machdep.cpu.family') || util.getValue(lines, 'hw.cpufamily');
|
||||||
result.model = util.getValue(lines, 'machdep.cpu.model');
|
result.model = util.getValue(lines, 'machdep.cpu.model');
|
||||||
result.stepping = util.getValue(lines, 'machdep.cpu.stepping');
|
result.stepping = util.getValue(lines, 'machdep.cpu.stepping') || util.getValue(lines, 'hw.cpusubfamily');
|
||||||
const countProcessors = util.getValue(lines, 'hw.packages');
|
const countProcessors = util.getValue(lines, 'hw.packages');
|
||||||
const countCores = util.getValue(lines, 'hw.physicalcpu_max');
|
const countCores = util.getValue(lines, 'hw.physicalcpu_max');
|
||||||
const countThreads = util.getValue(lines, 'hw.ncpu');
|
const countThreads = util.getValue(lines, 'hw.ncpu');
|
||||||
|
|||||||
@ -422,6 +422,27 @@ function memLayout(callback) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (!result.length) {
|
||||||
|
const lines = stdout.toString().split('\n');
|
||||||
|
const size = parseInt(util.getValue(lines, ' Memory:'));
|
||||||
|
const type = parseInt(util.getValue(lines, ' Type:'),);
|
||||||
|
if (size && type) {
|
||||||
|
result.push({
|
||||||
|
size,
|
||||||
|
bank: 0,
|
||||||
|
type,
|
||||||
|
clockSpeed: 0,
|
||||||
|
formFactor: '',
|
||||||
|
manufacturer: '',
|
||||||
|
partNum: '',
|
||||||
|
serialNum: '',
|
||||||
|
voltageConfigured: -1,
|
||||||
|
voltageMin: -1,
|
||||||
|
voltageMax: -1,
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
if (callback) { callback(result); }
|
if (callback) { callback(result); }
|
||||||
resolve(result);
|
resolve(result);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user