fix os max mamory (win), typings, graphics parse nvidia-smi
This commit is contained in:
parent
f7022c92f0
commit
43a673c331
@ -429,7 +429,7 @@ function graphics(callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const gpus = stdout.split('\n').filter(Boolean);
|
const gpus = stdout.split('\n').filter(Boolean);
|
||||||
const results = gpus.map(gpu => {
|
let results = gpus.map(gpu => {
|
||||||
const splittedData = gpu.split(', ').map(value => value.includes('N/A') ? undefined : value);
|
const splittedData = gpu.split(', ').map(value => value.includes('N/A') ? undefined : value);
|
||||||
if (splittedData.length === 16) {
|
if (splittedData.length === 16) {
|
||||||
return {
|
return {
|
||||||
@ -450,9 +450,13 @@ function graphics(callback) {
|
|||||||
clockCore: safeParseNumber(splittedData[14]),
|
clockCore: safeParseNumber(splittedData[14]),
|
||||||
clockMemory: safeParseNumber(splittedData[15]),
|
clockMemory: safeParseNumber(splittedData[15]),
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
results = results.filter((item) => {
|
||||||
|
return ('pciBus' in item);
|
||||||
|
});
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
lib/index.d.ts
vendored
4
lib/index.d.ts
vendored
@ -7,8 +7,8 @@ export namespace Systeminformation {
|
|||||||
// 1. General
|
// 1. General
|
||||||
|
|
||||||
interface TimeData {
|
interface TimeData {
|
||||||
current: string;
|
current: number;
|
||||||
uptime: string;
|
uptime: number;
|
||||||
timezone: string;
|
timezone: string;
|
||||||
timezoneName: string;
|
timezoneName: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -307,6 +307,7 @@ function osInfo(callback) {
|
|||||||
result.codename = (result.release.indexOf('10.15') > -1 ? 'macOS Catalina' : result.codename);
|
result.codename = (result.release.indexOf('10.15') > -1 ? 'macOS Catalina' : result.codename);
|
||||||
result.codename = (result.release.startsWith('11.') ? 'macOS Big Sur' : result.codename);
|
result.codename = (result.release.startsWith('11.') ? 'macOS Big Sur' : result.codename);
|
||||||
result.codename = (result.release.startsWith('12.') ? 'macOS Monterey' : result.codename);
|
result.codename = (result.release.startsWith('12.') ? 'macOS Monterey' : result.codename);
|
||||||
|
result.codename = (result.release.startsWith('13.') ? 'macOS Ventura' : result.codename);
|
||||||
result.uefi = true;
|
result.uefi = true;
|
||||||
result.codepage = util.getCodepage();
|
result.codepage = util.getCodepage();
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
|||||||
@ -662,8 +662,10 @@ function baseboard(callback) {
|
|||||||
if (_windows) {
|
if (_windows) {
|
||||||
try {
|
try {
|
||||||
const workload = [];
|
const workload = [];
|
||||||
|
const win10plus = parseInt(os.release()) >= 10;
|
||||||
|
const maxCapacityAttribute = win10plus ? 'MaxCapacityEx' : 'MaxCapacity';
|
||||||
workload.push(util.powerShell('Get-WmiObject Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU | fl'));
|
workload.push(util.powerShell('Get-WmiObject Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU | fl'));
|
||||||
workload.push(util.powerShell('Get-WmiObject Win32_physicalmemoryarray | select MaxCapacity, MemoryDevices | fl'));
|
workload.push(util.powerShell(`Get-WmiObject Win32_physicalmemoryarray | select ${maxCapacityAttribute}, MemoryDevices | fl`));
|
||||||
util.promiseAll(
|
util.promiseAll(
|
||||||
workload
|
workload
|
||||||
).then(data => {
|
).then(data => {
|
||||||
@ -683,7 +685,7 @@ function baseboard(callback) {
|
|||||||
|
|
||||||
// memphysical
|
// memphysical
|
||||||
lines = data.results[1] ? data.results[1].toString().split('\r\n') : [''];
|
lines = data.results[1] ? data.results[1].toString().split('\r\n') : [''];
|
||||||
result.memMax = util.toInt(util.getValue(lines, 'MaxCapacity', ':')) || null;
|
result.memMax = util.toInt(util.getValue(lines, maxCapacityAttribute, ':')) * (win10plus ? 1024 : 1) || null;
|
||||||
result.memSlots = util.toInt(util.getValue(lines, 'MemoryDevices', ':')) || null;
|
result.memSlots = util.toInt(util.getValue(lines, 'MemoryDevices', ':')) || null;
|
||||||
|
|
||||||
if (callback) { callback(result); }
|
if (callback) { callback(result); }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user