systeminformation 5.31.9 → 5.31.11

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.
package/lib/graphics.js CHANGED
@@ -337,9 +337,17 @@ function graphics(callback) {
337
337
  currentController.bus = 'Onboard';
338
338
  }
339
339
  if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('region') !== -1 && parts[1].toLowerCase().indexOf('memory') !== -1) {
340
- let memparts = parts[1].split('=');
341
- if (memparts.length > 1) {
342
- currentController.vram = parseInt(memparts[1]);
340
+ const sizeMatch = parts[1].match(/size=(\d+)([KMG])?/i);
341
+ if (sizeMatch) {
342
+ let vram = parseInt(sizeMatch[1], 10);
343
+ const unit = (sizeMatch[2] || '').toUpperCase();
344
+ if (unit === 'G') { vram *= 1024; }
345
+ else if (unit === 'K') { vram = Math.round(vram / 1024); }
346
+ else if (unit === '') { vram = Math.round(vram / 1024 / 1024); } // bytes
347
+ // keep the largest memory region (the actual framebuffer aperture)
348
+ if (currentController.vram === null || vram > currentController.vram) {
349
+ currentController.vram = vram;
350
+ }
343
351
  }
344
352
  }
345
353
  }
package/lib/memory.js CHANGED
@@ -258,13 +258,19 @@ function mem(callback) {
258
258
  util.noop();
259
259
  }
260
260
  try {
261
- exec('vm_stat 2>/dev/null | egrep "Pages active|Pages inactive"', (error, stdout) => {
261
+ exec('vm_stat 2>/dev/null | egrep "Pages active|Pages inactive|Pages speculative|Pages wired down|Pages occupied by compressor|Pages purgeable|File-backed pages|Anonymous pages"', (error, stdout) => {
262
262
  if (!error) {
263
263
  let lines = stdout.toString().split('\n');
264
- result.active = (parseInt(util.getValue(lines, 'Pages active'), 10) || 0) * pageSize;
264
+ const wired = (parseInt(util.getValue(lines, 'Pages wired down'), 10) || 0) * pageSize;
265
+ const compressed = (parseInt(util.getValue(lines, 'Pages occupied by compressor'), 10) || 0) * pageSize;
266
+ const purgeable = (parseInt(util.getValue(lines, 'Pages purgeable'), 10) || 0) * pageSize;
267
+ const anonymous = (parseInt(util.getValue(lines, 'Anonymous pages'), 10) || 0) * pageSize;
268
+
269
+ result.active = anonymous - purgeable + wired + compressed;
265
270
  result.reclaimable = (parseInt(util.getValue(lines, 'Pages inactive'), 10) || 0) * pageSize;
266
271
  result.buffcache = result.used - result.active;
267
272
  result.available = result.free + result.buffcache;
273
+
268
274
  }
269
275
  exec('sysctl -n vm.swapusage 2>/dev/null', (error, stdout) => {
270
276
  if (!error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.31.9",
3
+ "version": "5.31.11",
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)",