systeminformation 5.9.5 → 5.9.9

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/bluetooth.js CHANGED
@@ -1,183 +1,183 @@
1
- 'use strict';
2
- // @ts-check
3
- // ==================================================================================
4
- // audio.js
5
- // ----------------------------------------------------------------------------------
6
- // Description: System Information - library
7
- // for Node.js
8
- // Copyright: (c) 2014 - 2021
9
- // Author: Sebastian Hildebrandt
10
- // ----------------------------------------------------------------------------------
11
- // License: MIT
12
- // ==================================================================================
13
- // 17. bluetooth
14
- // ----------------------------------------------------------------------------------
15
-
16
- const exec = require('child_process').exec;
17
- const execSync = require('child_process').execSync;
18
- const path = require('path');
19
- const util = require('./util');
20
- const fs = require('fs');
21
-
22
- let _platform = process.platform;
23
-
24
- const _linux = (_platform === 'linux');
25
- const _darwin = (_platform === 'darwin');
26
- const _windows = (_platform === 'win32');
27
- const _freebsd = (_platform === 'freebsd');
28
- const _openbsd = (_platform === 'openbsd');
29
- const _netbsd = (_platform === 'netbsd');
30
- const _sunos = (_platform === 'sunos');
31
-
32
- function parseBluetoothTyoe(str) {
33
- let result = '';
34
-
35
- if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
36
- if (str.indexOf('mouse') >= 0) { result = 'Mouse'; }
37
- if (str.indexOf('speaker') >= 0) { result = 'Speaker'; }
38
- if (str.indexOf('headset') >= 0) { result = 'Headset'; }
39
- if (str.indexOf('phone') >= 0) { result = 'Phone'; }
40
- // to be continued ...
41
-
42
- return result;
43
- }
44
-
45
- function parseLinuxBluetoothInfo(lines, macAddr1, macAddr2) {
46
- const result = {};
47
-
48
- result.device = null;
49
- result.name = util.getValue(lines, 'name', '=');
50
- result.manufacturer = null;
51
- result.macDevice = macAddr1;
52
- result.macHost = macAddr2;
53
- result.batteryPercent = null;
54
- result.type = parseBluetoothTyoe(result.name.toLowerCase());
55
- result.connected = false;
56
-
57
- return result;
58
- }
59
-
60
- function parseDarwinBluetoothDevices(bluetoothObject, macAddr2) {
61
- const result = {};
62
- const typeStr = ((bluetoothObject.device_minorClassOfDevice_string || bluetoothObject.device_majorClassOfDevice_string || '') + (bluetoothObject.device_name || '')).toLowerCase();
63
-
64
- result.device = bluetoothObject.device_services || '';
65
- result.name = bluetoothObject.device_name || '';
66
- result.manufacturer = bluetoothObject.device_manufacturer || '';
67
- result.macDevice = (bluetoothObject.device_addr || '').toLowerCase().replace(/-/g, ':');
68
- result.macHost = macAddr2;
69
- result.batteryPercent = bluetoothObject.device_batteryPercent || null;
70
- result.type = parseBluetoothTyoe(typeStr);
71
- result.connected = bluetoothObject.device_isconnected === 'attrib_Yes' || false;
72
-
73
- return result;
74
- }
75
-
76
- function parseWindowsBluetooth(lines) {
77
- const result = {};
78
-
79
- result.device = null;
80
- result.name = util.getValue(lines, 'name', '=');
81
- result.manufacturer = util.getValue(lines, 'manufacturer', '=');
82
- result.macDevice = null;
83
- result.macHost = null;
84
- result.batteryPercent = null;
85
- result.type = parseBluetoothTyoe(result.name.toLowerCase());
86
- result.connected = null;
87
-
88
- return result;
89
- }
90
-
91
- function bluetoothDevices(callback) {
92
-
93
- return new Promise((resolve) => {
94
- process.nextTick(() => {
95
- let result = [];
96
- if (_linux) {
97
- // get files in /var/lib/bluetooth/ recursive
98
- const btFiles = util.getFilesInPath('/var/lib/bluetooth/');
99
- for (let i = 0; i < btFiles.length; i++) {
100
- const filename = path.basename(btFiles[i]);
101
- const pathParts = btFiles[i].split('/');
102
- const macAddr1 = pathParts.length >= 6 ? pathParts[pathParts.length - 2] : null;
103
- const macAddr2 = pathParts.length >= 7 ? pathParts[pathParts.length - 3] : null;
104
- if (filename === 'info') {
105
- const infoFile = fs.readFileSync(btFiles[i], { encoding: 'utf8' }).split('\n');
106
- result.push(parseLinuxBluetoothInfo(infoFile, macAddr1, macAddr2));
107
- }
108
- }
109
- // determine "connected" with hcitool con
110
- try {
111
- const hdicon = execSync('hcitool con').toString().toLowerCase();
112
- for (let i = 0; i < result.length; i++) {
113
- if (result[i].macDevice && result[i].macDevice.length > 10 && hdicon.indexOf(result[i].macDevice.toLowerCase()) >= 0) {
114
- result[i].connected = true;
115
- }
116
- }
117
- } catch (e) {
118
- util.noop();
119
- }
120
-
121
- if (callback) {
122
- callback(result);
123
- }
124
- resolve(result);
125
- }
126
- if (_darwin) {
127
- let cmd = 'system_profiler SPBluetoothDataType -json';
128
- exec(cmd, function (error, stdout) {
129
- if (!error) {
130
- try {
131
- const outObj = JSON.parse(stdout.toString());
132
- if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_title'] && outObj.SPBluetoothDataType[0]['device_title'].length) {
133
- // missing: host BT Adapter macAddr ()
134
- let macAddr2 = null;
135
- if (outObj.SPBluetoothDataType[0]['local_device_title'] && outObj.SPBluetoothDataType[0].local_device_title.general_address) {
136
- macAddr2 = outObj.SPBluetoothDataType[0].local_device_title.general_address.toLowerCase().replace(/-/g, ':');
137
- }
138
-
139
- for (let i = 0; i < outObj.SPBluetoothDataType[0]['device_title'].length; i++) {
140
- const obj = outObj.SPBluetoothDataType[0]['device_title'][i];
141
- const objKey = Object.keys(obj);
142
- if (objKey && objKey.length === 1) {
143
- const innerObject = obj[objKey[0]];
144
- innerObject.device_name = objKey[0];
145
- const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2);
146
- result.push(bluetoothDevice);
147
- }
148
- }
149
- }
150
- } catch (e) {
151
- util.noop();
152
- }
153
- }
154
- if (callback) {
155
- callback(result);
156
- }
157
- resolve(result);
158
- });
159
- }
160
- if (_windows) {
161
- util.wmic('path Win32_PNPEntity get /value', function (error, stdout) {
162
- if (!error) {
163
- const parts = stdout.toString().split(/\n\s*\n/);
164
- for (let i = 0; i < parts.length; i++) {
165
- if (util.getValue(parts[i].split('\n'), 'PNPClass', '=') === 'Bluetooth') {
166
- result.push(parseWindowsBluetooth(parts[i].split('\n')));
167
- }
168
- }
169
- }
170
- if (callback) {
171
- callback(result);
172
- }
173
- resolve(result);
174
- });
175
- }
176
- if (_freebsd || _netbsd || _openbsd || _sunos) {
177
- resolve(null);
178
- }
179
- });
180
- });
181
- }
182
-
183
- exports.bluetoothDevices = bluetoothDevices;
1
+ 'use strict';
2
+ // @ts-check
3
+ // ==================================================================================
4
+ // audio.js
5
+ // ----------------------------------------------------------------------------------
6
+ // Description: System Information - library
7
+ // for Node.js
8
+ // Copyright: (c) 2014 - 2021
9
+ // Author: Sebastian Hildebrandt
10
+ // ----------------------------------------------------------------------------------
11
+ // License: MIT
12
+ // ==================================================================================
13
+ // 17. bluetooth
14
+ // ----------------------------------------------------------------------------------
15
+
16
+ const exec = require('child_process').exec;
17
+ const execSync = require('child_process').execSync;
18
+ const path = require('path');
19
+ const util = require('./util');
20
+ const fs = require('fs');
21
+
22
+ let _platform = process.platform;
23
+
24
+ const _linux = (_platform === 'linux');
25
+ const _darwin = (_platform === 'darwin');
26
+ const _windows = (_platform === 'win32');
27
+ const _freebsd = (_platform === 'freebsd');
28
+ const _openbsd = (_platform === 'openbsd');
29
+ const _netbsd = (_platform === 'netbsd');
30
+ const _sunos = (_platform === 'sunos');
31
+
32
+ function parseBluetoothType(str) {
33
+ let result = '';
34
+
35
+ if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
36
+ if (str.indexOf('mouse') >= 0) { result = 'Mouse'; }
37
+ if (str.indexOf('speaker') >= 0) { result = 'Speaker'; }
38
+ if (str.indexOf('headset') >= 0) { result = 'Headset'; }
39
+ if (str.indexOf('phone') >= 0) { result = 'Phone'; }
40
+ // to be continued ...
41
+
42
+ return result;
43
+ }
44
+
45
+ function parseLinuxBluetoothInfo(lines, macAddr1, macAddr2) {
46
+ const result = {};
47
+
48
+ result.device = null;
49
+ result.name = util.getValue(lines, 'name', '=');
50
+ result.manufacturer = null;
51
+ result.macDevice = macAddr1;
52
+ result.macHost = macAddr2;
53
+ result.batteryPercent = null;
54
+ result.type = parseBluetoothType(result.name.toLowerCase());
55
+ result.connected = false;
56
+
57
+ return result;
58
+ }
59
+
60
+ function parseDarwinBluetoothDevices(bluetoothObject, macAddr2) {
61
+ const result = {};
62
+ const typeStr = ((bluetoothObject.device_minorClassOfDevice_string || bluetoothObject.device_majorClassOfDevice_string || '') + (bluetoothObject.device_name || '')).toLowerCase();
63
+
64
+ result.device = bluetoothObject.device_services || '';
65
+ result.name = bluetoothObject.device_name || '';
66
+ result.manufacturer = bluetoothObject.device_manufacturer || '';
67
+ result.macDevice = (bluetoothObject.device_addr || '').toLowerCase().replace(/-/g, ':');
68
+ result.macHost = macAddr2;
69
+ result.batteryPercent = bluetoothObject.device_batteryPercent || null;
70
+ result.type = parseBluetoothType(typeStr);
71
+ result.connected = bluetoothObject.device_isconnected === 'attrib_Yes' || false;
72
+
73
+ return result;
74
+ }
75
+
76
+ function parseWindowsBluetooth(lines) {
77
+ const result = {};
78
+
79
+ result.device = null;
80
+ result.name = util.getValue(lines, 'name', ':');
81
+ result.manufacturer = util.getValue(lines, 'manufacturer', ':');
82
+ result.macDevice = null;
83
+ result.macHost = null;
84
+ result.batteryPercent = null;
85
+ result.type = parseBluetoothType(result.name.toLowerCase());
86
+ result.connected = null;
87
+
88
+ return result;
89
+ }
90
+
91
+ function bluetoothDevices(callback) {
92
+
93
+ return new Promise((resolve) => {
94
+ process.nextTick(() => {
95
+ let result = [];
96
+ if (_linux) {
97
+ // get files in /var/lib/bluetooth/ recursive
98
+ const btFiles = util.getFilesInPath('/var/lib/bluetooth/');
99
+ for (let i = 0; i < btFiles.length; i++) {
100
+ const filename = path.basename(btFiles[i]);
101
+ const pathParts = btFiles[i].split('/');
102
+ const macAddr1 = pathParts.length >= 6 ? pathParts[pathParts.length - 2] : null;
103
+ const macAddr2 = pathParts.length >= 7 ? pathParts[pathParts.length - 3] : null;
104
+ if (filename === 'info') {
105
+ const infoFile = fs.readFileSync(btFiles[i], { encoding: 'utf8' }).split('\n');
106
+ result.push(parseLinuxBluetoothInfo(infoFile, macAddr1, macAddr2));
107
+ }
108
+ }
109
+ // determine "connected" with hcitool con
110
+ try {
111
+ const hdicon = execSync('hcitool con').toString().toLowerCase();
112
+ for (let i = 0; i < result.length; i++) {
113
+ if (result[i].macDevice && result[i].macDevice.length > 10 && hdicon.indexOf(result[i].macDevice.toLowerCase()) >= 0) {
114
+ result[i].connected = true;
115
+ }
116
+ }
117
+ } catch (e) {
118
+ util.noop();
119
+ }
120
+
121
+ if (callback) {
122
+ callback(result);
123
+ }
124
+ resolve(result);
125
+ }
126
+ if (_darwin) {
127
+ let cmd = 'system_profiler SPBluetoothDataType -json';
128
+ exec(cmd, function (error, stdout) {
129
+ if (!error) {
130
+ try {
131
+ const outObj = JSON.parse(stdout.toString());
132
+ if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_title'] && outObj.SPBluetoothDataType[0]['device_title'].length) {
133
+ // missing: host BT Adapter macAddr ()
134
+ let macAddr2 = null;
135
+ if (outObj.SPBluetoothDataType[0]['local_device_title'] && outObj.SPBluetoothDataType[0].local_device_title.general_address) {
136
+ macAddr2 = outObj.SPBluetoothDataType[0].local_device_title.general_address.toLowerCase().replace(/-/g, ':');
137
+ }
138
+
139
+ for (let i = 0; i < outObj.SPBluetoothDataType[0]['device_title'].length; i++) {
140
+ const obj = outObj.SPBluetoothDataType[0]['device_title'][i];
141
+ const objKey = Object.keys(obj);
142
+ if (objKey && objKey.length === 1) {
143
+ const innerObject = obj[objKey[0]];
144
+ innerObject.device_name = objKey[0];
145
+ const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2);
146
+ result.push(bluetoothDevice);
147
+ }
148
+ }
149
+ }
150
+ } catch (e) {
151
+ util.noop();
152
+ }
153
+ }
154
+ if (callback) {
155
+ callback(result);
156
+ }
157
+ resolve(result);
158
+ });
159
+ }
160
+ if (_windows) {
161
+ util.powerShell('Get-WmiObject Win32_PNPEntity | fl *').then((stdout, error) => {
162
+ if (!error) {
163
+ const parts = stdout.toString().split(/\n\s*\n/);
164
+ for (let i = 0; i < parts.length; i++) {
165
+ if (util.getValue(parts[i].split('\n'), 'PNPClass', ':') === 'Bluetooth') {
166
+ result.push(parseWindowsBluetooth(parts[i].split('\n')));
167
+ }
168
+ }
169
+ }
170
+ if (callback) {
171
+ callback(result);
172
+ }
173
+ resolve(result);
174
+ });
175
+ }
176
+ if (_freebsd || _netbsd || _openbsd || _sunos) {
177
+ resolve(null);
178
+ }
179
+ });
180
+ });
181
+ }
182
+
183
+ exports.bluetoothDevices = bluetoothDevices;
package/lib/cpu.js CHANGED
@@ -373,10 +373,12 @@ const AMDBaseFrequencies = {
373
373
  '4700G': '3.6',
374
374
  'Pro 4750G': '3.6',
375
375
  '4300U': '2.7',
376
+ '4450U': '2.5',
376
377
  'Pro 4450U': '2.5',
377
378
  '4500U': '2.3',
378
379
  '4600U': '2.1',
379
380
  'PRO 4650U': '2.1',
381
+ '4680U': '2.1',
380
382
  '4600HS': '3.0',
381
383
  '4600H': '3.0',
382
384
  '4700U': '2.0',
@@ -386,6 +388,9 @@ const AMDBaseFrequencies = {
386
388
  '4800H': '2.9',
387
389
  '4900HS': '3.0',
388
390
  '4900H': '3.3',
391
+ '5300U': '2.6',
392
+ '5500U': '2.1',
393
+ '5700U': '1.8',
389
394
 
390
395
  // ZEN2 - EPYC
391
396
  '7232P': '3.1',
@@ -414,6 +419,28 @@ const AMDBaseFrequencies = {
414
419
  '7F52': '3.5',
415
420
  '7F72': '3.2',
416
421
 
422
+ // Epyc (Milan)
423
+
424
+ '7763': '2.45',
425
+ '7713': '2.0',
426
+ '7713P': '2.0',
427
+ '7663': '2.0',
428
+ '7643': '2.3',
429
+ '75F3': '2.95',
430
+ '7543': '2.8',
431
+ '7543P': '2.8',
432
+ '7513': '2.6',
433
+ '7453': '2.75',
434
+ '74F3': '3.2',
435
+ '7443': '2.85',
436
+ '7443P': '2.85',
437
+ '7413': '2.65',
438
+ '73F3': '3.5',
439
+ '7343': '3.2',
440
+ '7313': '3.0',
441
+ '7313P': '3.0',
442
+ '72F3': '3.7',
443
+
417
444
  // ZEN3
418
445
  '5600X': '3.7',
419
446
  '5800X': '3.8',
@@ -421,6 +448,7 @@ const AMDBaseFrequencies = {
421
448
  '5950X': '3.4'
422
449
  };
423
450
 
451
+
424
452
  const socketTypes = {
425
453
  1: 'Other',
426
454
  2: 'Unknown',
@@ -484,6 +512,7 @@ const socketTypes = {
484
512
  60: 'BGA1528',
485
513
  61: 'LGA4189',
486
514
  62: 'LGA1200',
515
+ 63: 'LGA4677',
487
516
  };
488
517
 
489
518
  function cpuBrandManufacturer(res) {
@@ -739,8 +768,8 @@ function getCpu() {
739
768
  const threadCount = util.getValue(lines, 'thread count').trim();
740
769
  const coreCount = util.getValue(lines, 'core count').trim();
741
770
  if (coreCount && threadCount) {
742
- result.cores = threadCount;
743
- result.physicalCores = coreCount;
771
+ result.cores = parseInt(threadCount, 10);
772
+ result.physicalCores = parseInt(coreCount, 10);
744
773
  }
745
774
  resolve(result);
746
775
  });
@@ -751,8 +780,8 @@ function getCpu() {
751
780
  if (_windows) {
752
781
  try {
753
782
  const workload = [];
754
- workload.push(util.wmic('cpu get /value'));
755
- workload.push(util.wmic('path Win32_CacheMemory get CacheType,InstalledSize,Purpose'));
783
+ workload.push(util.powerShell('Get-WmiObject Win32_processor | fl *'));
784
+ workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Purpose | fl *'));
756
785
  // workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
757
786
  workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
758
787
 
@@ -760,7 +789,7 @@ function getCpu() {
760
789
  workload
761
790
  ).then(data => {
762
791
  let lines = data[0].split('\r\n');
763
- let name = util.getValue(lines, 'name', '=') || '';
792
+ let name = util.getValue(lines, 'name', ':') || '';
764
793
  if (name.indexOf('@') >= 0) {
765
794
  result.brand = name.split('@')[0].trim();
766
795
  result.speed = name.split('@')[1] ? parseFloat(name.split('@')[1].trim()) : 0;
@@ -770,15 +799,15 @@ function getCpu() {
770
799
  result.speed = 0;
771
800
  }
772
801
  result = cpuBrandManufacturer(result);
773
- result.revision = util.getValue(lines, 'revision', '=');
802
+ result.revision = util.getValue(lines, 'revision', ':');
774
803
  result.cache.l1d = 0;
775
804
  result.cache.l1i = 0;
776
- result.cache.l2 = util.getValue(lines, 'l2cachesize', '=');
777
- result.cache.l3 = util.getValue(lines, 'l3cachesize', '=');
805
+ result.cache.l2 = util.getValue(lines, 'l2cachesize', ':');
806
+ result.cache.l3 = util.getValue(lines, 'l3cachesize', ':');
778
807
  if (result.cache.l2) { result.cache.l2 = parseInt(result.cache.l2, 10) * 1024; }
779
808
  if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3, 10) * 1024; }
780
- result.vendor = util.getValue(lines, 'manufacturer', '=');
781
- result.speedMax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', '=').replace(/,/g, '.')) / 10.0) / 100;
809
+ result.vendor = util.getValue(lines, 'manufacturer', ':');
810
+ result.speedMax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', ':').replace(/,/g, '.')) / 10.0) / 100;
782
811
  if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
783
812
  result.speed = getAMDSpeed(result.brand);
784
813
  }
@@ -787,7 +816,7 @@ function getCpu() {
787
816
  }
788
817
  result.speedMin = result.speed;
789
818
 
790
- let description = util.getValue(lines, 'description', '=').split(' ');
819
+ let description = util.getValue(lines, 'description', ':').split(' ');
791
820
  for (let i = 0; i < description.length; i++) {
792
821
  if (description[i].toLowerCase().startsWith('family') && (i + 1) < description.length && description[i + 1]) {
793
822
  result.family = description[i + 1];
@@ -800,14 +829,14 @@ function getCpu() {
800
829
  }
801
830
  }
802
831
  // socket type
803
- const socketId = util.getValue(lines, 'UpgradeMethod', '=');
832
+ const socketId = util.getValue(lines, 'UpgradeMethod', ':');
804
833
  if (socketTypes[socketId]) {
805
834
  result.socket = socketTypes[socketId];
806
835
  }
807
836
  // # threads / # cores
808
837
  const countProcessors = util.countLines(lines, 'Caption');
809
- const countThreads = util.getValue(lines, 'NumberOfLogicalProcessors', '=');
810
- const countCores = util.getValue(lines, 'NumberOfCores', '=');
838
+ const countThreads = util.getValue(lines, 'NumberOfLogicalProcessors', ':');
839
+ const countCores = util.getValue(lines, 'NumberOfCores', ':');
811
840
  if (countProcessors) {
812
841
  result.processors = parseInt(countProcessors) || 1;
813
842
  }
@@ -819,18 +848,19 @@ function getCpu() {
819
848
  result.cores = result.cores * countProcessors;
820
849
  result.physicalCores = result.physicalCores * countProcessors;
821
850
  }
822
- lines = data[1].split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
823
- lines.forEach(function (line) {
824
- if (line !== '') {
825
- line = line.trim().split(/\s\s+/);
826
- // L1 Instructions
827
- if (line[2] === 'L1 Cache' && line[0] === '3') {
828
- result.cache.l1i = parseInt(line[1], 10);
829
- }
830
- // L1 Data
831
- if (line[2] === 'L1 Cache' && line[0] === '4') {
832
- result.cache.l1d = parseInt(line[1], 10);
833
- }
851
+ const parts = data[1].split(/\n\s*\n/);
852
+ parts.forEach(function (part) {
853
+ lines = part.split('\r\n');
854
+ const cacheType = util.getValue(lines, 'CacheType');
855
+ const purpose = util.getValue(lines, 'Purpose');
856
+ const installedSize = util.getValue(lines, 'InstalledSize');
857
+ // L1 Instructions
858
+ if (purpose === 'L1 Cache' && cacheType === '3') {
859
+ result.cache.l1i = parseInt(installedSize, 10);
860
+ }
861
+ // L1 Data
862
+ if (purpose === 'L1 Cache' && cacheType === '4') {
863
+ result.cache.l1d = parseInt(installedSize, 10);
834
864
  }
835
865
  });
836
866
  // lines = data[2].split('\r\n');
@@ -1134,7 +1164,7 @@ function cpuTemperature(callback) {
1134
1164
  }
1135
1165
  if (_windows) {
1136
1166
  try {
1137
- util.wmic('/namespace:\\\\root\\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature').then((stdout, error) => {
1167
+ util.powerShell('Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | Select CurrentTemperature').then((stdout, error) => {
1138
1168
  if (!error) {
1139
1169
  let sum = 0;
1140
1170
  let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
@@ -1236,7 +1266,7 @@ function cpuFlags(callback) {
1236
1266
  let flags = [];
1237
1267
  if (!error) {
1238
1268
  let parts = stdout.toString().split('\tFlags:');
1239
- const lines = parts.length > 1 ? parts[1].split('\tVersion:')[0].split['\n'] : [];
1269
+ const lines = parts.length > 1 ? parts[1].split('\tVersion:')[0].split('\n') : [];
1240
1270
  lines.forEach(function (line) {
1241
1271
  let flag = (line.indexOf('(') ? line.split('(')[0].toLowerCase() : '').trim().replace(/\t/g, '');
1242
1272
  if (flag) {
@@ -1373,30 +1403,31 @@ function cpuCache(callback) {
1373
1403
  }
1374
1404
  if (_windows) {
1375
1405
  try {
1376
- util.wmic('cpu get l2cachesize, l3cachesize /value').then((stdout, error) => {
1406
+ util.powerShell('Get-WmiObject Win32_processor | fl *').then((stdout, error) => {
1377
1407
  if (!error) {
1378
1408
  let lines = stdout.split('\r\n');
1379
1409
  result.l1d = 0;
1380
1410
  result.l1i = 0;
1381
- result.l2 = util.getValue(lines, 'l2cachesize', '=');
1382
- result.l3 = util.getValue(lines, 'l3cachesize', '=');
1411
+ result.l2 = util.getValue(lines, 'l2cachesize', ':');
1412
+ result.l3 = util.getValue(lines, 'l3cachesize', ':');
1383
1413
  if (result.l2) { result.l2 = parseInt(result.l2, 10) * 1024; }
1384
1414
  if (result.l3) { result.l3 = parseInt(result.l3, 10) * 1024; }
1385
1415
  }
1386
- util.wmic('path Win32_CacheMemory get CacheType,InstalledSize,Purpose').then((stdout, error) => {
1416
+ util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Purpose | fl ').then((stdout, error) => {
1387
1417
  if (!error) {
1388
- let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
1389
- lines.forEach(function (line) {
1390
- if (line !== '') {
1391
- line = line.trim().split(/\s\s+/);
1392
- // L1 Instructions
1393
- if (line[2] === 'L1 Cache' && line[0] === '3') {
1394
- result.l1i = parseInt(line[1], 10);
1395
- }
1396
- // L1 Data
1397
- if (line[2] === 'L1 Cache' && line[0] === '4') {
1398
- result.l1d = parseInt(line[1], 10);
1399
- }
1418
+ const parts = stdout.split(/\n\s*\n/);
1419
+ parts.forEach(function (part) {
1420
+ const lines = part.split('\r\n');
1421
+ const cacheType = util.getValue(lines, 'CacheType');
1422
+ const purpose = util.getValue(lines, 'Purpose');
1423
+ const installedSize = util.getValue(lines, 'InstalledSize');
1424
+ // L1 Instructions
1425
+ if (purpose === 'L1 Cache' && cacheType === '3') {
1426
+ result.l1i = parseInt(installedSize, 10);
1427
+ }
1428
+ // L1 Data
1429
+ if (purpose === 'L1 Cache' && cacheType === '4') {
1430
+ result.l1d = parseInt(installedSize, 10);
1400
1431
  }
1401
1432
  });
1402
1433
  }
@@ -1536,18 +1567,18 @@ function getLoad() {
1536
1567
  }
1537
1568
  result = {
1538
1569
  avgLoad: avgLoad,
1539
- currentload: _current_cpu.currentload,
1540
- currentloadUser: _current_cpu.currentloadUser,
1541
- currentloadSystem: _current_cpu.currentloadSystem,
1542
- currentloadNice: _current_cpu.currentloadNice,
1543
- currentloadIdle: _current_cpu.currentloadIdle,
1544
- currentloadIrq: _current_cpu.currentloadIrq,
1545
- rawCurrentload: _current_cpu.rawCurrentload,
1546
- rawCurrentloadUser: _current_cpu.rawCurrentloadUser,
1547
- rawCurrentloadSystem: _current_cpu.rawCurrentloadSystem,
1548
- rawCurrentloadNice: _current_cpu.rawCurrentloadNice,
1549
- rawCurrentloadIdle: _current_cpu.rawCurrentloadIdle,
1550
- rawCurrentloadIrq: _current_cpu.rawCurrentloadIrq,
1570
+ currentLoad: _current_cpu.currentLoad,
1571
+ currentLoadUser: _current_cpu.currentLoadUser,
1572
+ currentLoadSystem: _current_cpu.currentLoadSystem,
1573
+ currentLoadNice: _current_cpu.currentLoadNice,
1574
+ currentLoadIdle: _current_cpu.currentLoadIdle,
1575
+ currentLoadIrq: _current_cpu.currentLoadIrq,
1576
+ rawCurrentLoad: _current_cpu.rawCurrentLoad,
1577
+ rawCurrentLoadUser: _current_cpu.rawCurrentLoadUser,
1578
+ rawCurrentLoadSystem: _current_cpu.rawCurrentLoadSystem,
1579
+ rawCurrentLoadNice: _current_cpu.rawCurrentLoadNice,
1580
+ rawCurrentLoadIdle: _current_cpu.rawCurrentLoadIdle,
1581
+ rawCurrentLoadIrq: _current_cpu.rawCurrentLoadIrq,
1551
1582
  cpus: cores
1552
1583
  };
1553
1584
  }
package/lib/docker.js CHANGED
@@ -543,7 +543,12 @@ function dockerContainerStatsSingle(containerID) {
543
543
  blockIO: {
544
544
  r: 0,
545
545
  w: 0
546
- }
546
+ },
547
+ restartCount: 0,
548
+ cpuStats: {},
549
+ precpuStats: {},
550
+ memoryStats: {},
551
+ networks: {},
547
552
  };
548
553
  return new Promise((resolve) => {
549
554
  process.nextTick(() => {