systeminformation 5.18.9 → 5.18.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/cpu.js +76 -62
  2. package/package.json +1 -1
package/lib/cpu.js CHANGED
@@ -542,6 +542,15 @@ const socketTypes = {
542
542
  61: 'LGA4189',
543
543
  62: 'LGA1200',
544
544
  63: 'LGA4677',
545
+ 64: 'LGA1700',
546
+ 65: 'BGA1744',
547
+ 66: 'BGA1781',
548
+ 67: 'BGA1211',
549
+ 68: 'BGA2422',
550
+ 69: 'LGA1211',
551
+ 70: 'LGA2422',
552
+ 71: 'LGA5773',
553
+ 72: 'BGA5773',
545
554
  };
546
555
 
547
556
  const socketTypesByName = {
@@ -862,12 +871,6 @@ function getCpu() {
862
871
  }
863
872
  result = cpuBrandManufacturer(result);
864
873
  result.revision = util.getValue(lines, 'revision', ':');
865
- result.cache.l1d = 0;
866
- result.cache.l1i = 0;
867
- result.cache.l2 = util.getValue(lines, 'l2cachesize', ':');
868
- result.cache.l3 = util.getValue(lines, 'l3cachesize', ':');
869
- if (result.cache.l2) { result.cache.l2 = parseInt(result.cache.l2, 10) * 1024; }
870
- if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3, 10) * 1024; }
871
874
  result.vendor = util.getValue(lines, 'manufacturer', ':');
872
875
  result.speedMax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', ':').replace(/,/g, '.')) / 10.0) / 100;
873
876
  if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
@@ -914,26 +917,7 @@ function getCpu() {
914
917
  result.cores = result.cores * countProcessors;
915
918
  result.physicalCores = result.physicalCores * countProcessors;
916
919
  }
917
- const parts = data[1].split(/\n\s*\n/);
918
- parts.forEach(function (part) {
919
- lines = part.split('\r\n');
920
- const cacheType = util.getValue(lines, 'CacheType');
921
- const level = util.getValue(lines, 'Level');
922
- const installedSize = util.getValue(lines, 'InstalledSize');
923
- // L1 Instructions
924
- if (level === '3' && cacheType === '3') {
925
- result.cache.l1i = parseInt(installedSize, 10);
926
- }
927
- // L1 Data
928
- if (level === '3' && cacheType === '4') {
929
- result.cache.l1d = parseInt(installedSize, 10);
930
- }
931
- // L1 all
932
- if (level === '3' && cacheType === '5' && !result.cache.l1i && !result.cache.l1d) {
933
- result.cache.l1i = parseInt(installedSize, 10) / 2;
934
- result.cache.l1d = parseInt(installedSize, 10) / 2;
935
- }
936
- });
920
+ result.cache = parseWinCache(data[0], data[1]);
937
921
  const hyperv = data[2] ? data[2].toString().toLowerCase() : '';
938
922
  result.virtualization = hyperv.indexOf('true') !== -1;
939
923
 
@@ -1483,42 +1467,17 @@ function cpuCache(callback) {
1483
1467
  }
1484
1468
  if (_windows) {
1485
1469
  try {
1486
- util.powerShell('Get-CimInstance Win32_processor | select L2CacheSize, L3CacheSize | fl').then((stdout, error) => {
1487
- if (!error) {
1488
- let lines = stdout.split('\r\n');
1489
- result.l1d = 0;
1490
- result.l1i = 0;
1491
- result.l2 = util.getValue(lines, 'l2cachesize', ':');
1492
- result.l3 = util.getValue(lines, 'l3cachesize', ':');
1493
- if (result.l2) { result.l2 = parseInt(result.l2, 10) * 1024; }
1494
- if (result.l3) { result.l3 = parseInt(result.l3, 10) * 1024; }
1495
- }
1496
- util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl').then((stdout, error) => {
1497
- if (!error) {
1498
- const parts = stdout.split(/\n\s*\n/);
1499
- parts.forEach(function (part) {
1500
- const lines = part.split('\r\n');
1501
- const cacheType = util.getValue(lines, 'CacheType');
1502
- const level = util.getValue(lines, 'Level');
1503
- const installedSize = util.getValue(lines, 'InstalledSize');
1504
- // L1 Instructions
1505
- if (level === '3' && cacheType === '3') {
1506
- result.l1i = parseInt(installedSize, 10);
1507
- }
1508
- // L1 Data
1509
- if (level === '3' && cacheType === '4') {
1510
- result.l1d = parseInt(installedSize, 10);
1511
- }
1512
- // L1 all
1513
- if (level === '3' && cacheType === '5' && !result.l1i && !result.l1d) {
1514
- result.l1i = parseInt(installedSize, 10) / 2;
1515
- result.l1d = parseInt(installedSize, 10) / 2;
1516
- }
1517
- });
1518
- }
1519
- if (callback) { callback(result); }
1520
- resolve(result);
1521
- });
1470
+ const workload = [];
1471
+ workload.push(util.powerShell('Get-CimInstance Win32_processor | select L2CacheSize, L3CacheSize | fl'));
1472
+ workload.push(util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl'));
1473
+
1474
+ Promise.all(
1475
+ workload
1476
+ ).then((data) => {
1477
+ result = parseWinCache(data[0], data[1]);
1478
+
1479
+ if (callback) { callback(result); }
1480
+ resolve(result);
1522
1481
  });
1523
1482
  } catch (e) {
1524
1483
  if (callback) { callback(result); }
@@ -1529,6 +1488,61 @@ function cpuCache(callback) {
1529
1488
  });
1530
1489
  }
1531
1490
 
1491
+ function parseWinCache(linesProc, linesCache) {
1492
+ let result = {
1493
+ l1d: null,
1494
+ l1i: null,
1495
+ l2: null,
1496
+ l3: null,
1497
+ };
1498
+
1499
+ // Win32_processor
1500
+ let lines = linesProc.split('\r\n');
1501
+ result.l1d = 0;
1502
+ result.l1i = 0;
1503
+ result.l2 = util.getValue(lines, 'l2cachesize', ':');
1504
+ result.l3 = util.getValue(lines, 'l3cachesize', ':');
1505
+ if (result.l2) { result.l2 = parseInt(result.l2, 10) * 1024; } else { result.l2 = 0; }
1506
+ if (result.l3) { result.l3 = parseInt(result.l3, 10) * 1024; } else { result.l3 = 0; }
1507
+
1508
+ // Win32_CacheMemory
1509
+ const parts = linesCache.split(/\n\s*\n/);
1510
+ let l1i = 0;
1511
+ let l1d = 0;
1512
+ let l2 = 0;
1513
+ parts.forEach(function (part) {
1514
+ const lines = part.split('\r\n');
1515
+ const cacheType = util.getValue(lines, 'CacheType');
1516
+ const level = util.getValue(lines, 'Level');
1517
+ const installedSize = util.getValue(lines, 'InstalledSize');
1518
+ // L1 Instructions
1519
+ if (level === '3' && cacheType === '3') {
1520
+ result.l1i = result.l1i + parseInt(installedSize, 10) * 1024;
1521
+ }
1522
+ // L1 Data
1523
+ if (level === '3' && cacheType === '4') {
1524
+ result.l1d = result.l1d + parseInt(installedSize, 10) * 1024;
1525
+ }
1526
+ // L1 all
1527
+ if (level === '3' && cacheType === '5') {
1528
+ l1i = parseInt(installedSize, 10) / 2;
1529
+ l1d = parseInt(installedSize, 10) / 2;
1530
+ }
1531
+ // L2
1532
+ if (level === '4' && cacheType === '5') {
1533
+ l2 = l2 + parseInt(installedSize, 10) * 1024;
1534
+ }
1535
+ });
1536
+ if (!result.l1i && !result.l1d) {
1537
+ result.l1i = l1i;
1538
+ result.l1d = l1d;
1539
+ }
1540
+ if (l2) {
1541
+ result.l2 = l2;
1542
+ }
1543
+ return result;
1544
+ }
1545
+
1532
1546
  exports.cpuCache = cpuCache;
1533
1547
 
1534
1548
  // --------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.18.9",
3
+ "version": "5.18.10",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",