systeminformation 5.27.12 → 5.27.13

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 +502 -348
  2. package/package.json +1 -1
package/lib/cpu.js CHANGED
@@ -19,15 +19,15 @@ const execSync = require('child_process').execSync;
19
19
  const fs = require('fs');
20
20
  const util = require('./util');
21
21
 
22
- let _platform = process.platform;
22
+ const _platform = process.platform;
23
23
 
24
- const _linux = (_platform === 'linux' || _platform === 'android');
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');
24
+ const _linux = _platform === 'linux' || _platform === 'android';
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
31
 
32
32
  let _cpu_speed = 0;
33
33
  let _current_cpu = {
@@ -62,113 +62,113 @@ let _cpus = [];
62
62
  let _corecount = 0;
63
63
 
64
64
  const AMDBaseFrequencies = {
65
- '8346': '1.8',
66
- '8347': '1.9',
67
- '8350': '2.0',
68
- '8354': '2.2',
65
+ 8346: '1.8',
66
+ 8347: '1.9',
67
+ 8350: '2.0',
68
+ 8354: '2.2',
69
69
  '8356|SE': '2.4',
70
- '8356': '2.3',
71
- '8360': '2.5',
72
- '2372': '2.1',
73
- '2373': '2.1',
74
- '2374': '2.2',
75
- '2376': '2.3',
76
- '2377': '2.3',
77
- '2378': '2.4',
78
- '2379': '2.4',
79
- '2380': '2.5',
80
- '2381': '2.5',
81
- '2382': '2.6',
82
- '2384': '2.7',
83
- '2386': '2.8',
84
- '2387': '2.8',
85
- '2389': '2.9',
86
- '2393': '3.1',
87
- '8374': '2.2',
88
- '8376': '2.3',
89
- '8378': '2.4',
90
- '8379': '2.4',
91
- '8380': '2.5',
92
- '8381': '2.5',
93
- '8382': '2.6',
94
- '8384': '2.7',
95
- '8386': '2.8',
96
- '8387': '2.8',
97
- '8389': '2.9',
98
- '8393': '3.1',
70
+ 8356: '2.3',
71
+ 8360: '2.5',
72
+ 2372: '2.1',
73
+ 2373: '2.1',
74
+ 2374: '2.2',
75
+ 2376: '2.3',
76
+ 2377: '2.3',
77
+ 2378: '2.4',
78
+ 2379: '2.4',
79
+ 2380: '2.5',
80
+ 2381: '2.5',
81
+ 2382: '2.6',
82
+ 2384: '2.7',
83
+ 2386: '2.8',
84
+ 2387: '2.8',
85
+ 2389: '2.9',
86
+ 2393: '3.1',
87
+ 8374: '2.2',
88
+ 8376: '2.3',
89
+ 8378: '2.4',
90
+ 8379: '2.4',
91
+ 8380: '2.5',
92
+ 8381: '2.5',
93
+ 8382: '2.6',
94
+ 8384: '2.7',
95
+ 8386: '2.8',
96
+ 8387: '2.8',
97
+ 8389: '2.9',
98
+ 8393: '3.1',
99
99
  '2419EE': '1.8',
100
100
  '2423HE': '2.0',
101
101
  '2425HE': '2.1',
102
- '2427': '2.2',
103
- '2431': '2.4',
104
- '2435': '2.6',
102
+ 2427: '2.2',
103
+ 2431: '2.4',
104
+ 2435: '2.6',
105
105
  '2439SE': '2.8',
106
106
  '8425HE': '2.1',
107
- '8431': '2.4',
108
- '8435': '2.6',
107
+ 8431: '2.4',
108
+ 8435: '2.6',
109
109
  '8439SE': '2.8',
110
- '4122': '2.2',
111
- '4130': '2.6',
110
+ 4122: '2.2',
111
+ 4130: '2.6',
112
112
  '4162EE': '1.7',
113
113
  '4164EE': '1.8',
114
114
  '4170HE': '2.1',
115
115
  '4174HE': '2.3',
116
116
  '4176HE': '2.4',
117
- '4180': '2.6',
118
- '4184': '2.8',
117
+ 4180: '2.6',
118
+ 4184: '2.8',
119
119
  '6124HE': '1.8',
120
120
  '6128HE': '2.0',
121
121
  '6132HE': '2.2',
122
- '6128': '2.0',
123
- '6134': '2.3',
124
- '6136': '2.4',
125
- '6140': '2.6',
122
+ 6128: '2.0',
123
+ 6134: '2.3',
124
+ 6136: '2.4',
125
+ 6140: '2.6',
126
126
  '6164HE': '1.7',
127
127
  '6166HE': '1.8',
128
- '6168': '1.9',
129
- '6172': '2.1',
130
- '6174': '2.2',
131
- '6176': '2.3',
128
+ 6168: '1.9',
129
+ 6172: '2.1',
130
+ 6174: '2.2',
131
+ 6176: '2.3',
132
132
  '6176SE': '2.3',
133
133
  '6180SE': '2.5',
134
- '3250': '2.5',
135
- '3260': '2.7',
136
- '3280': '2.4',
137
- '4226': '2.7',
138
- '4228': '2.8',
139
- '4230': '2.9',
140
- '4234': '3.1',
141
- '4238': '3.3',
142
- '4240': '3.4',
143
- '4256': '1.6',
144
- '4274': '2.5',
145
- '4276': '2.6',
146
- '4280': '2.8',
147
- '4284': '3.0',
148
- '6204': '3.3',
149
- '6212': '2.6',
150
- '6220': '3.0',
151
- '6234': '2.4',
152
- '6238': '2.6',
134
+ 3250: '2.5',
135
+ 3260: '2.7',
136
+ 3280: '2.4',
137
+ 4226: '2.7',
138
+ 4228: '2.8',
139
+ 4230: '2.9',
140
+ 4234: '3.1',
141
+ 4238: '3.3',
142
+ 4240: '3.4',
143
+ 4256: '1.6',
144
+ 4274: '2.5',
145
+ 4276: '2.6',
146
+ 4280: '2.8',
147
+ 4284: '3.0',
148
+ 6204: '3.3',
149
+ 6212: '2.6',
150
+ 6220: '3.0',
151
+ 6234: '2.4',
152
+ 6238: '2.6',
153
153
  '6262HE': '1.6',
154
- '6272': '2.1',
155
- '6274': '2.2',
156
- '6276': '2.3',
157
- '6278': '2.4',
154
+ 6272: '2.1',
155
+ 6274: '2.2',
156
+ 6276: '2.3',
157
+ 6278: '2.4',
158
158
  '6282SE': '2.6',
159
159
  '6284SE': '2.7',
160
- '6308': '3.5',
161
- '6320': '2.8',
162
- '6328': '3.2',
160
+ 6308: '3.5',
161
+ 6320: '2.8',
162
+ 6328: '3.2',
163
163
  '6338P': '2.3',
164
- '6344': '2.6',
165
- '6348': '2.8',
166
- '6366': '1.8',
164
+ 6344: '2.6',
165
+ 6348: '2.8',
166
+ 6366: '1.8',
167
167
  '6370P': '2.0',
168
- '6376': '2.3',
169
- '6378': '2.4',
170
- '6380': '2.5',
171
- '6386': '2.8',
168
+ 6376: '2.3',
169
+ 6378: '2.4',
170
+ 6380: '2.5',
171
+ 6386: '2.8',
172
172
  'FX|4100': '3.6',
173
173
  'FX|4120': '3.9',
174
174
  'FX|4130': '3.8',
@@ -199,23 +199,23 @@ const AMDBaseFrequencies = {
199
199
  'FX|8370E': '3.3',
200
200
 
201
201
  // ZEN Desktop CPUs
202
- '1200': '3.1',
202
+ 1200: '3.1',
203
203
  'Pro 1200': '3.1',
204
204
  '1300X': '3.5',
205
205
  'Pro 1300': '3.5',
206
- '1400': '3.2',
206
+ 1400: '3.2',
207
207
  '1500X': '3.5',
208
208
  'Pro 1500': '3.5',
209
- '1600': '3.2',
209
+ 1600: '3.2',
210
210
  '1600X': '3.6',
211
211
  'Pro 1600': '3.2',
212
- '1700': '3.0',
212
+ 1700: '3.0',
213
213
  'Pro 1700': '3.0',
214
214
  '1700X': '3.4',
215
215
  'Pro 1700X': '3.4',
216
216
  '1800X': '3.6',
217
217
  '1900X': '3.8',
218
- '1920': '3.2',
218
+ 1920: '3.2',
219
219
  '1920X': '3.5',
220
220
  '1950X': '3.4',
221
221
 
@@ -251,50 +251,50 @@ const AMDBaseFrequencies = {
251
251
  '2800H': '3.3',
252
252
 
253
253
  // ZEN Server Processors
254
- '7351': '2.4',
254
+ 7351: '2.4',
255
255
  '7351P': '2.4',
256
- '7401': '2.0',
256
+ 7401: '2.0',
257
257
  '7401P': '2.0',
258
258
  '7551P': '2.0',
259
- '7551': '2.0',
260
- '7251': '2.1',
261
- '7261': '2.5',
262
- '7281': '2.1',
263
- '7301': '2.2',
264
- '7371': '3.1',
265
- '7451': '2.3',
266
- '7501': '2.0',
267
- '7571': '2.2',
268
- '7601': '2.2',
259
+ 7551: '2.0',
260
+ 7251: '2.1',
261
+ 7261: '2.5',
262
+ 7281: '2.1',
263
+ 7301: '2.2',
264
+ 7371: '3.1',
265
+ 7451: '2.3',
266
+ 7501: '2.0',
267
+ 7571: '2.2',
268
+ 7601: '2.2',
269
269
 
270
270
  // ZEN Embedded Processors
271
- 'V1500B': '2.2',
272
- 'V1780B': '3.35',
273
- 'V1202B': '2.3',
274
- 'V1404I': '2.0',
275
- 'V1605B': '2.0',
276
- 'V1756B': '3.25',
277
- 'V1807B': '3.35',
278
-
279
- '3101': '2.1',
280
- '3151': '2.7',
281
- '3201': '1.5',
282
- '3251': '2.5',
283
- '3255': '2.5',
284
- '3301': '2.0',
285
- '3351': '1.9',
286
- '3401': '1.85',
287
- '3451': '2.15',
271
+ V1500B: '2.2',
272
+ V1780B: '3.35',
273
+ V1202B: '2.3',
274
+ V1404I: '2.0',
275
+ V1605B: '2.0',
276
+ V1756B: '3.25',
277
+ V1807B: '3.35',
278
+
279
+ 3101: '2.1',
280
+ 3151: '2.7',
281
+ 3201: '1.5',
282
+ 3251: '2.5',
283
+ 3255: '2.5',
284
+ 3301: '2.0',
285
+ 3351: '1.9',
286
+ 3401: '1.85',
287
+ 3451: '2.15',
288
288
 
289
289
  // ZEN+ Desktop
290
290
  '1200|AF': '3.1',
291
291
  '2300X': '3.5',
292
292
  '2500X': '3.6',
293
- '2600': '3.4',
293
+ 2600: '3.4',
294
294
  '2600E': '3.1',
295
295
  '1600|AF': '3.2',
296
296
  '2600X': '3.6',
297
- '2700': '3.2',
297
+ 2700: '3.2',
298
298
  '2700E': '2.8',
299
299
  'Pro 2700': '3.2',
300
300
  '2700X': '3.7',
@@ -340,11 +340,11 @@ const AMDBaseFrequencies = {
340
340
  '3780U': '2.3',
341
341
 
342
342
  // ZEN2 Desktop CPUS
343
- '3100': '3.6',
343
+ 3100: '3.6',
344
344
  '3300X': '3.8',
345
- '3500': '3.6',
345
+ 3500: '3.6',
346
346
  '3500X': '3.6',
347
- '3600': '3.6',
347
+ 3600: '3.6',
348
348
  'Pro 3600': '3.6',
349
349
  '3600X': '3.8',
350
350
  '3600XT': '3.8',
@@ -352,7 +352,7 @@ const AMDBaseFrequencies = {
352
352
  '3700X': '3.6',
353
353
  '3800X': '3.9',
354
354
  '3800XT': '3.9',
355
- '3900': '3.1',
355
+ 3900: '3.1',
356
356
  'Pro 3900': '3.1',
357
357
  '3900X': '3.8',
358
358
  '3900XT': '3.8',
@@ -404,22 +404,22 @@ const AMDBaseFrequencies = {
404
404
  '7402P': '2.8',
405
405
  '7502P': '2.5',
406
406
  '7702P': '2.0',
407
- '7252': '3.1',
408
- '7262': '3.2',
409
- '7272': '2.9',
410
- '7282': '2.8',
411
- '7302': '3.0',
412
- '7352': '2.3',
413
- '7402': '2.8',
414
- '7452': '2.35',
415
- '7502': '2.5',
416
- '7532': '2.4',
417
- '7542': '2.9',
418
- '7552': '2.2',
419
- '7642': '2.3',
420
- '7662': '2.0',
421
- '7702': '2.0',
422
- '7742': '2.25',
407
+ 7252: '3.1',
408
+ 7262: '3.2',
409
+ 7272: '2.9',
410
+ 7282: '2.8',
411
+ 7302: '3.0',
412
+ 7352: '2.3',
413
+ 7402: '2.8',
414
+ 7452: '2.35',
415
+ 7502: '2.5',
416
+ 7532: '2.4',
417
+ 7542: '2.9',
418
+ 7552: '2.2',
419
+ 7642: '2.3',
420
+ 7662: '2.0',
421
+ 7702: '2.0',
422
+ 7742: '2.25',
423
423
  '7H12': '2.6',
424
424
  '7F32': '3.7',
425
425
  '7F52': '3.5',
@@ -428,26 +428,26 @@ const AMDBaseFrequencies = {
428
428
  // Epyc (Milan)
429
429
 
430
430
  '7773X': '2.2',
431
- '7763': '2.45',
432
- '7713': '2.0',
431
+ 7763: '2.45',
432
+ 7713: '2.0',
433
433
  '7713P': '2.0',
434
- '7663': '2.0',
435
- '7643': '2.3',
434
+ 7663: '2.0',
435
+ 7643: '2.3',
436
436
  '7573X': '2.8',
437
437
  '75F3': '2.95',
438
- '7543': '2.8',
438
+ 7543: '2.8',
439
439
  '7543P': '2.8',
440
- '7513': '2.6',
440
+ 7513: '2.6',
441
441
  '7473X': '2.8',
442
- '7453': '2.75',
442
+ 7453: '2.75',
443
443
  '74F3': '3.2',
444
- '7443': '2.85',
444
+ 7443: '2.85',
445
445
  '7443P': '2.85',
446
- '7413': '2.65',
446
+ 7413: '2.65',
447
447
  '7373X': '3.05',
448
448
  '73F3': '3.5',
449
- '7343': '3.2',
450
- '7313': '3.0',
449
+ 7343: '3.2',
450
+ 7313: '3.0',
451
451
  '7313P': '3.0',
452
452
  '72F3': '3.7',
453
453
 
@@ -472,30 +472,30 @@ const AMDBaseFrequencies = {
472
472
  '7995WX': '2.5',
473
473
 
474
474
  // ZEN4
475
- '9754': '2.25',
475
+ 9754: '2.25',
476
476
  '9754S': '2.25',
477
- '9734': '2.2',
477
+ 9734: '2.2',
478
478
  '9684X': '2.55',
479
479
  '9384X': '3.1',
480
480
  '9184X': '3.55',
481
481
  '9654P': '2.4',
482
- '9654': '2.4',
483
- '9634': '2.25',
482
+ 9654: '2.4',
483
+ 9634: '2.25',
484
484
  '9554P': '3.1',
485
- '9554': '3.1',
486
- '9534': '2.45',
485
+ 9554: '3.1',
486
+ 9534: '2.45',
487
487
  '9474F': '3.6',
488
488
  '9454P': '2.75',
489
- '9454': '2.75',
489
+ 9454: '2.75',
490
490
  '9374F': '3.85',
491
491
  '9354P': '3.25',
492
- '9354': '3.25',
493
- '9334': '2.7',
492
+ 9354: '3.25',
493
+ 9334: '2.7',
494
494
  '9274F': '4.05',
495
- '9254': '2.9',
496
- '9224': '2.5',
495
+ 9254: '2.9',
496
+ 9224: '2.5',
497
497
  '9174F': '4.1',
498
- '9124': '3.0'
498
+ 9124: '3.0'
499
499
  };
500
500
 
501
501
  const socketTypes = {
@@ -589,16 +589,18 @@ const socketTypes = {
589
589
  };
590
590
 
591
591
  const socketTypesByName = {
592
- 'LGA1150': 'i7-5775C i3-4340 i3-4170 G3250 i3-4160T i3-4160 E3-1231 G3258 G3240 i7-4790S i7-4790K i7-4790 i5-4690K i5-4690 i5-4590T i5-4590S i5-4590 i5-4460 i3-4360 i3-4150 G1820 G3420 G3220 i7-4771 i5-4440 i3-4330 i3-4130T i3-4130 E3-1230 i7-4770S i7-4770K i7-4770 i5-4670K i5-4670 i5-4570T i5-4570S i5-4570 i5-4430',
593
- 'LGA1151': 'i9-9900KS E-2288G E-2224 G5420 i9-9900T i9-9900 i7-9700T i7-9700F i7-9700E i7-9700 i5-9600 i5-9500T i5-9500F i5-9500 i5-9400T i3-9350K i3-9300 i3-9100T i3-9100F i3-9100 G4930 i9-9900KF i7-9700KF i5-9600KF i5-9400F i5-9400 i3-9350KF i9-9900K i7-9700K i5-9600K G5500 G5400 i7-8700T i7-8086K i5-8600 i5-8500T i5-8500 i5-8400T i3-8300 i3-8100T G4900 i7-8700K i7-8700 i5-8600K i5-8400 i3-8350K i3-8100 E3-1270 G4600 G4560 i7-7700T i7-7700K i7-7700 i5-7600K i5-7600 i5-7500T i5-7500 i5-7400 i3-7350K i3-7300 i3-7100T i3-7100 G3930 G3900 G4400 i7-6700T i7-6700K i7-6700 i5-6600K i5-6600 i5-6500T i5-6500 i5-6400T i5-6400 i3-6300 i3-6100T i3-6100 E3-1270 E3-1270 T4500 T4400',
594
- '1155': 'G440 G460 G465 G470 G530T G540T G550T G1610T G1620T G530 G540 G1610 G550 G1620 G555 G1630 i3-2100T i3-2120T i3-3220T i3-3240T i3-3250T i3-2100 i3-2105 i3-2102 i3-3210 i3-3220 i3-2125 i3-2120 i3-3225 i3-2130 i3-3245 i3-3240 i3-3250 i5-3570T i5-2500T i5-2400S i5-2405S i5-2390T i5-3330S i5-2500S i5-3335S i5-2300 i5-3450S i5-3340S i5-3470S i5-3475S i5-3470T i5-2310 i5-3550S i5-2320 i5-3330 i5-3350P i5-3450 i5-2400 i5-3340 i5-3570S i5-2380P i5-2450P i5-3470 i5-2500K i5-3550 i5-2500 i5-3570 i5-3570K i5-2550K i7-3770T i7-2600S i7-3770S i7-2600K i7-2600 i7-3770 i7-3770K i7-2700K G620T G630T G640T G2020T G645T G2100T G2030T G622 G860T G620 G632 G2120T G630 G640 G2010 G840 G2020 G850 G645 G2030 G860 G2120 G870 G2130 G2140 E3-1220L E3-1220L E3-1260L E3-1265L E3-1220 E3-1225 E3-1220 E3-1235 E3-1225 E3-1230 E3-1230 E3-1240 E3-1245 E3-1270 E3-1275 E3-1240 E3-1245 E3-1270 E3-1280 E3-1275 E3-1290 E3-1280 E3-1290'
592
+ LGA1150:
593
+ 'i7-5775C i3-4340 i3-4170 G3250 i3-4160T i3-4160 E3-1231 G3258 G3240 i7-4790S i7-4790K i7-4790 i5-4690K i5-4690 i5-4590T i5-4590S i5-4590 i5-4460 i3-4360 i3-4150 G1820 G3420 G3220 i7-4771 i5-4440 i3-4330 i3-4130T i3-4130 E3-1230 i7-4770S i7-4770K i7-4770 i5-4670K i5-4670 i5-4570T i5-4570S i5-4570 i5-4430',
594
+ LGA1151:
595
+ 'i9-9900KS E-2288G E-2224 G5420 i9-9900T i9-9900 i7-9700T i7-9700F i7-9700E i7-9700 i5-9600 i5-9500T i5-9500F i5-9500 i5-9400T i3-9350K i3-9300 i3-9100T i3-9100F i3-9100 G4930 i9-9900KF i7-9700KF i5-9600KF i5-9400F i5-9400 i3-9350KF i9-9900K i7-9700K i5-9600K G5500 G5400 i7-8700T i7-8086K i5-8600 i5-8500T i5-8500 i5-8400T i3-8300 i3-8100T G4900 i7-8700K i7-8700 i5-8600K i5-8400 i3-8350K i3-8100 E3-1270 G4600 G4560 i7-7700T i7-7700K i7-7700 i5-7600K i5-7600 i5-7500T i5-7500 i5-7400 i3-7350K i3-7300 i3-7100T i3-7100 G3930 G3900 G4400 i7-6700T i7-6700K i7-6700 i5-6600K i5-6600 i5-6500T i5-6500 i5-6400T i5-6400 i3-6300 i3-6100T i3-6100 E3-1270 E3-1270 T4500 T4400',
596
+ 1155: 'G440 G460 G465 G470 G530T G540T G550T G1610T G1620T G530 G540 G1610 G550 G1620 G555 G1630 i3-2100T i3-2120T i3-3220T i3-3240T i3-3250T i3-2100 i3-2105 i3-2102 i3-3210 i3-3220 i3-2125 i3-2120 i3-3225 i3-2130 i3-3245 i3-3240 i3-3250 i5-3570T i5-2500T i5-2400S i5-2405S i5-2390T i5-3330S i5-2500S i5-3335S i5-2300 i5-3450S i5-3340S i5-3470S i5-3475S i5-3470T i5-2310 i5-3550S i5-2320 i5-3330 i5-3350P i5-3450 i5-2400 i5-3340 i5-3570S i5-2380P i5-2450P i5-3470 i5-2500K i5-3550 i5-2500 i5-3570 i5-3570K i5-2550K i7-3770T i7-2600S i7-3770S i7-2600K i7-2600 i7-3770 i7-3770K i7-2700K G620T G630T G640T G2020T G645T G2100T G2030T G622 G860T G620 G632 G2120T G630 G640 G2010 G840 G2020 G850 G645 G2030 G860 G2120 G870 G2130 G2140 E3-1220L E3-1220L E3-1260L E3-1265L E3-1220 E3-1225 E3-1220 E3-1235 E3-1225 E3-1230 E3-1230 E3-1240 E3-1245 E3-1270 E3-1275 E3-1240 E3-1245 E3-1270 E3-1280 E3-1275 E3-1290 E3-1280 E3-1290'
595
597
  };
596
598
 
597
599
  function getSocketTypesByName(str) {
598
600
  let result = '';
599
601
  for (const key in socketTypesByName) {
600
602
  const names = socketTypesByName[key].split(' ');
601
- names.forEach(element => {
603
+ names.forEach((element) => {
602
604
  if (str.indexOf(element) >= 0) {
603
605
  result = key;
604
606
  }
@@ -611,26 +613,59 @@ function cpuManufacturer(str) {
611
613
  let result = str;
612
614
  str = str.toLowerCase();
613
615
 
614
- if (str.indexOf('intel') >= 0) { result = 'Intel'; }
615
- if (str.indexOf('amd') >= 0) { result = 'AMD'; }
616
- if (str.indexOf('qemu') >= 0) { result = 'QEMU'; }
617
- if (str.indexOf('hygon') >= 0) { result = 'Hygon'; }
618
- if (str.indexOf('centaur') >= 0) { result = 'WinChip/Via'; }
619
- if (str.indexOf('vmware') >= 0) { result = 'VMware'; }
620
- if (str.indexOf('Xen') >= 0) { result = 'Xen Hypervisor'; }
621
- if (str.indexOf('tcg') >= 0) { result = 'QEMU'; }
622
- if (str.indexOf('apple') >= 0) { result = 'Apple'; }
623
- if (str.indexOf('sifive') >= 0) { result = 'SiFive'; }
624
- if (str.indexOf('thead') >= 0) { result = 'T-Head'; }
625
- if (str.indexOf('andestech') >= 0) { result = 'Andes Technology'; }
616
+ if (str.indexOf('intel') >= 0) {
617
+ result = 'Intel';
618
+ }
619
+ if (str.indexOf('amd') >= 0) {
620
+ result = 'AMD';
621
+ }
622
+ if (str.indexOf('qemu') >= 0) {
623
+ result = 'QEMU';
624
+ }
625
+ if (str.indexOf('hygon') >= 0) {
626
+ result = 'Hygon';
627
+ }
628
+ if (str.indexOf('centaur') >= 0) {
629
+ result = 'WinChip/Via';
630
+ }
631
+ if (str.indexOf('vmware') >= 0) {
632
+ result = 'VMware';
633
+ }
634
+ if (str.indexOf('Xen') >= 0) {
635
+ result = 'Xen Hypervisor';
636
+ }
637
+ if (str.indexOf('tcg') >= 0) {
638
+ result = 'QEMU';
639
+ }
640
+ if (str.indexOf('apple') >= 0) {
641
+ result = 'Apple';
642
+ }
643
+ if (str.indexOf('sifive') >= 0) {
644
+ result = 'SiFive';
645
+ }
646
+ if (str.indexOf('thead') >= 0) {
647
+ result = 'T-Head';
648
+ }
649
+ if (str.indexOf('andestech') >= 0) {
650
+ result = 'Andes Technology';
651
+ }
626
652
 
627
653
  return result;
628
654
  }
629
655
 
630
656
  function cpuBrandManufacturer(res) {
631
- res.brand = res.brand.replace(/\(R\)+/g, '®').replace(/\s+/g, ' ').trim();
632
- res.brand = res.brand.replace(/\(TM\)+/g, '').replace(/\s+/g, ' ').trim();
633
- res.brand = res.brand.replace(/\(C\)+/g, '©').replace(/\s+/g, ' ').trim();
657
+ res.brand = res.brand
658
+ .replace(/\(R\)+/g, '®')
659
+ .replace(/\s+/g, ' ')
660
+ .trim();
661
+ res.brand = res.brand
662
+ .replace(/\(TM\)+/g, '™')
663
+ .replace(/\s+/g, ' ')
664
+ .trim();
665
+ res.brand = res.brand
666
+ .replace(/\(C\)+/g, '©')
667
+ .replace(/\s+/g, ' ')
668
+ .trim();
634
669
  res.brand = res.brand.replace(/CPU+/g, '').replace(/\s+/g, ' ').trim();
635
670
  res.manufacturer = cpuManufacturer(res.brand);
636
671
 
@@ -646,7 +681,7 @@ function getAMDSpeed(brand) {
646
681
  if ({}.hasOwnProperty.call(AMDBaseFrequencies, key)) {
647
682
  let parts = key.split('|');
648
683
  let found = 0;
649
- parts.forEach(item => {
684
+ parts.forEach((item) => {
650
685
  if (brand.indexOf(item) > -1) {
651
686
  found++;
652
687
  }
@@ -663,7 +698,6 @@ function getAMDSpeed(brand) {
663
698
  // CPU - brand, speed
664
699
 
665
700
  function getCpu() {
666
-
667
701
  return new Promise((resolve) => {
668
702
  process.nextTick(() => {
669
703
  const UNKNOWN = 'unknown';
@@ -690,7 +724,7 @@ function getCpu() {
690
724
  virtualization: false,
691
725
  cache: {}
692
726
  };
693
- cpuFlags().then(flags => {
727
+ cpuFlags().then((flags) => {
694
728
  result.flags = flags;
695
729
  result.virtualization = flags.indexOf('vmx') > -1 || flags.indexOf('svm') > -1;
696
730
  if (_darwin) {
@@ -707,8 +741,8 @@ function getCpu() {
707
741
 
708
742
  _cpu_speed = result.speed;
709
743
  result = cpuBrandManufacturer(result);
710
- result.speedMin = util.getValue(lines, 'hw.cpufrequency_min') ? (util.getValue(lines, 'hw.cpufrequency_min') / 1000000000.0) : result.speed;
711
- result.speedMax = util.getValue(lines, 'hw.cpufrequency_max') ? (util.getValue(lines, 'hw.cpufrequency_max') / 1000000000.0) : result.speed;
744
+ result.speedMin = util.getValue(lines, 'hw.cpufrequency_min') ? util.getValue(lines, 'hw.cpufrequency_min') / 1000000000.0 : result.speed;
745
+ result.speedMax = util.getValue(lines, 'hw.cpufrequency_max') ? util.getValue(lines, 'hw.cpufrequency_max') / 1000000000.0 : result.speed;
712
746
  result.vendor = util.getValue(lines, 'machdep.cpu.vendor') || 'Apple';
713
747
  result.family = util.getValue(lines, 'machdep.cpu.family') || util.getValue(lines, 'hw.cpufamily');
714
748
  result.model = util.getValue(lines, 'machdep.cpu.model');
@@ -721,8 +755,8 @@ function getCpu() {
721
755
  result.socket = 'SOC';
722
756
  try {
723
757
  const clusters = execSync('ioreg -c IOPlatformDevice -d 3 -r | grep cluster-type').toString().split('\n');
724
- const efficiencyCores = clusters.filter(line => line.indexOf('"E"') >= 0).length;
725
- const performanceCores = clusters.filter(line => line.indexOf('"P"') >= 0).length;
758
+ const efficiencyCores = clusters.filter((line) => line.indexOf('"E"') >= 0).length;
759
+ const performanceCores = clusters.filter((line) => line.indexOf('"P"') >= 0).length;
726
760
  result.efficiencyCores = efficiencyCores;
727
761
  result.performanceCores = performanceCores;
728
762
  } catch (e) {
@@ -745,7 +779,9 @@ function getCpu() {
745
779
  if (_linux) {
746
780
  let modelline = '';
747
781
  let lines = [];
748
- if (os.cpus()[0] && os.cpus()[0].model) { modelline = os.cpus()[0].model; }
782
+ if (os.cpus()[0] && os.cpus()[0].model) {
783
+ modelline = os.cpus()[0].model;
784
+ }
749
785
  exec('export LC_ALL=C; lscpu; echo -n "Governor: "; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null; echo; unset LC_ALL', function (error, stdout) {
750
786
  if (!error) {
751
787
  lines = stdout.toString().split('\n');
@@ -764,7 +800,9 @@ function getCpu() {
764
800
  }
765
801
  if (result.speed === 0) {
766
802
  const current = getCpuCurrentSpeedSync();
767
- if (current.avg !== 0) { result.speed = current.avg; }
803
+ if (current.avg !== 0) {
804
+ result.speed = current.avg;
805
+ }
768
806
  }
769
807
  _cpu_speed = result.speed;
770
808
  result.speedMin = Math.round(parseFloat(util.getValue(lines, 'cpu min mhz').replace(/,/g, '.')) / 10.0) / 100;
@@ -778,22 +816,30 @@ function getCpu() {
778
816
  result.stepping = util.getValue(lines, 'stepping');
779
817
  result.revision = util.getValue(lines, 'cpu revision');
780
818
  result.cache.l1d = util.getValue(lines, 'l1d cache');
781
- if (result.cache.l1d) { result.cache.l1d = parseInt(result.cache.l1d) * (result.cache.l1d.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l1d.indexOf('K') !== -1 ? 1024 : 1)); }
819
+ if (result.cache.l1d) {
820
+ result.cache.l1d = parseInt(result.cache.l1d) * (result.cache.l1d.indexOf('M') !== -1 ? 1024 * 1024 : result.cache.l1d.indexOf('K') !== -1 ? 1024 : 1);
821
+ }
782
822
  result.cache.l1i = util.getValue(lines, 'l1i cache');
783
- if (result.cache.l1i) { result.cache.l1i = parseInt(result.cache.l1i) * (result.cache.l1i.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l1i.indexOf('K') !== -1 ? 1024 : 1)); }
823
+ if (result.cache.l1i) {
824
+ result.cache.l1i = parseInt(result.cache.l1i) * (result.cache.l1i.indexOf('M') !== -1 ? 1024 * 1024 : result.cache.l1i.indexOf('K') !== -1 ? 1024 : 1);
825
+ }
784
826
  result.cache.l2 = util.getValue(lines, 'l2 cache');
785
- if (result.cache.l2) { result.cache.l2 = parseInt(result.cache.l2) * (result.cache.l2.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l2.indexOf('K') !== -1 ? 1024 : 1)); }
827
+ if (result.cache.l2) {
828
+ result.cache.l2 = parseInt(result.cache.l2) * (result.cache.l2.indexOf('M') !== -1 ? 1024 * 1024 : result.cache.l2.indexOf('K') !== -1 ? 1024 : 1);
829
+ }
786
830
  result.cache.l3 = util.getValue(lines, 'l3 cache');
787
- if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3) * (result.cache.l3.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l3.indexOf('K') !== -1 ? 1024 : 1)); }
831
+ if (result.cache.l3) {
832
+ result.cache.l3 = parseInt(result.cache.l3) * (result.cache.l3.indexOf('M') !== -1 ? 1024 * 1024 : result.cache.l3.indexOf('K') !== -1 ? 1024 : 1);
833
+ }
788
834
 
789
835
  const threadsPerCore = util.getValue(lines, 'thread(s) per core') || '1';
790
836
  const processors = util.getValue(lines, 'socket(s)') || '1';
791
837
  const threadsPerCoreInt = parseInt(threadsPerCore, 10); // threads per code (normally only for performance cores)
792
- const processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1)
838
+ const processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1)
793
839
  const coresPerSocket = parseInt(util.getValue(lines, 'core(s) per socket'), 10); // number of cores (e.g. 16 on i12900)
794
840
  result.physicalCores = coresPerSocket ? coresPerSocket * processorsInt : result.cores / threadsPerCoreInt;
795
841
  result.performanceCores = threadsPerCoreInt > 1 ? result.cores - result.physicalCores : result.cores;
796
- result.efficiencyCores = threadsPerCoreInt > 1 ? result.cores - (threadsPerCoreInt * result.performanceCores) : 0;
842
+ result.efficiencyCores = threadsPerCoreInt > 1 ? result.cores - threadsPerCoreInt * result.performanceCores : 0;
797
843
  result.processors = processorsInt;
798
844
  result.governor = util.getValue(lines, 'governor') || '';
799
845
 
@@ -832,7 +878,9 @@ function getCpu() {
832
878
  if (_freebsd || _openbsd || _netbsd) {
833
879
  let modelline = '';
834
880
  let lines = [];
835
- if (os.cpus()[0] && os.cpus()[0].model) { modelline = os.cpus()[0].model; }
881
+ if (os.cpus()[0] && os.cpus()[0].model) {
882
+ modelline = os.cpus()[0].model;
883
+ }
836
884
  exec('export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 unset LC_ALL', function (error, stdout) {
837
885
  let cache = [];
838
886
  if (!error) {
@@ -849,7 +897,9 @@ function getCpu() {
849
897
  }
850
898
  if (result.speed === 0) {
851
899
  const current = getCpuCurrentSpeedSync();
852
- if (current.avg !== 0) { result.speed = current.avg; }
900
+ if (current.avg !== 0) {
901
+ result.speed = current.avg;
902
+ }
853
903
  }
854
904
  _cpu_speed = result.speed;
855
905
  result.speedMin = result.speed;
@@ -875,7 +925,7 @@ function getCpu() {
875
925
  const sizeParts = util.getValue(lines, 'Installed Size').split(' ');
876
926
  let size = parseInt(sizeParts[0], 10);
877
927
  const unit = sizeParts.length > 1 ? sizeParts[1] : 'kb';
878
- size = size * (unit === 'kb' ? 1024 : (unit === 'mb' ? 1024 * 1024 : (unit === 'gb' ? 1024 * 1024 * 1024 : 1)));
928
+ size = size * (unit === 'kb' ? 1024 : unit === 'mb' ? 1024 * 1024 : unit === 'gb' ? 1024 * 1024 * 1024 : 1);
879
929
  if (cacheType) {
880
930
  if (cacheType === 'l1') {
881
931
  result.cache[cacheType + 'd'] = size / 2;
@@ -903,13 +953,15 @@ function getCpu() {
903
953
  if (_windows) {
904
954
  try {
905
955
  const workload = [];
906
- workload.push(util.powerShell('Get-CimInstance Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl'));
956
+ workload.push(
957
+ util.powerShell(
958
+ 'Get-CimInstance Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl'
959
+ )
960
+ );
907
961
  workload.push(util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl'));
908
962
  workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
909
963
 
910
- Promise.all(
911
- workload
912
- ).then((data) => {
964
+ Promise.all(workload).then((data) => {
913
965
  let lines = data[0].split('\r\n');
914
966
  let name = util.getValue(lines, 'name', ':') || '';
915
967
  if (name.indexOf('@') >= 0) {
@@ -934,13 +986,13 @@ function getCpu() {
934
986
 
935
987
  let description = util.getValue(lines, 'description', ':').split(' ');
936
988
  for (let i = 0; i < description.length; i++) {
937
- if (description[i].toLowerCase().startsWith('family') && (i + 1) < description.length && description[i + 1]) {
989
+ if (description[i].toLowerCase().startsWith('family') && i + 1 < description.length && description[i + 1]) {
938
990
  result.family = description[i + 1];
939
991
  }
940
- if (description[i].toLowerCase().startsWith('model') && (i + 1) < description.length && description[i + 1]) {
992
+ if (description[i].toLowerCase().startsWith('model') && i + 1 < description.length && description[i + 1]) {
941
993
  result.model = description[i + 1];
942
994
  }
943
- if (description[i].toLowerCase().startsWith('stepping') && (i + 1) < description.length && description[i + 1]) {
995
+ if (description[i].toLowerCase().startsWith('stepping') && i + 1 < description.length && description[i + 1]) {
944
996
  result.stepping = description[i + 1];
945
997
  }
946
998
  }
@@ -987,11 +1039,12 @@ function getCpu() {
987
1039
  // CPU - Processor Data
988
1040
 
989
1041
  function cpu(callback) {
990
-
991
1042
  return new Promise((resolve) => {
992
1043
  process.nextTick(() => {
993
- getCpu().then(result => {
994
- if (callback) { callback(result); }
1044
+ getCpu().then((result) => {
1045
+ if (callback) {
1046
+ callback(result);
1047
+ }
995
1048
  resolve(result);
996
1049
  });
997
1050
  });
@@ -1004,21 +1057,23 @@ exports.cpu = cpu;
1004
1057
  // CPU - current speed - in GHz
1005
1058
 
1006
1059
  function getCpuCurrentSpeedSync() {
1007
-
1008
- let cpus = os.cpus();
1060
+ const cpus = os.cpus();
1009
1061
  let minFreq = 999999999;
1010
1062
  let maxFreq = 0;
1011
1063
  let avgFreq = 0;
1012
- let cores = [];
1013
- let speeds = [];
1064
+ const cores = [];
1065
+ const speeds = [];
1014
1066
 
1015
- if (cpus && cpus.length && cpus[0].hasOwnProperty('speed')) {
1067
+ if (cpus?.length && Object.prototype.hasOwnProperty.call(cpus[0], 'speed')) {
1016
1068
  for (let i in cpus) {
1017
1069
  speeds.push(cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10);
1018
1070
  }
1019
1071
  } else if (_linux) {
1020
1072
  try {
1021
- const speedStrings = execSync('cat /proc/cpuinfo | grep "cpu MHz" | cut -d " " -f 3', util.execOptsLinux).toString().split('\n').filter((line) => line.length > 0);
1073
+ const speedStrings = execSync('cat /proc/cpuinfo | grep "cpu MHz" | cut -d " " -f 3', util.execOptsLinux)
1074
+ .toString()
1075
+ .split('\n')
1076
+ .filter((line) => line.length > 0);
1022
1077
  for (let i in speedStrings) {
1023
1078
  speeds.push(Math.floor(parseInt(speedStrings[i], 10) / 10) / 100);
1024
1079
  }
@@ -1027,19 +1082,23 @@ function getCpuCurrentSpeedSync() {
1027
1082
  }
1028
1083
  }
1029
1084
 
1030
- if (speeds && speeds.length) {
1085
+ if (speeds?.length) {
1031
1086
  try {
1032
- for (let i in speeds) {
1087
+ for (const i in speeds) {
1033
1088
  avgFreq = avgFreq + speeds[i];
1034
- if (speeds[i] > maxFreq) { maxFreq = speeds[i]; }
1035
- if (speeds[i] < minFreq) { minFreq = speeds[i]; }
1089
+ if (speeds[i] > maxFreq) {
1090
+ maxFreq = speeds[i];
1091
+ }
1092
+ if (speeds[i] < minFreq) {
1093
+ minFreq = speeds[i];
1094
+ }
1036
1095
  cores.push(parseFloat(speeds[i].toFixed(2)));
1037
1096
  }
1038
1097
  avgFreq = avgFreq / speeds.length;
1039
1098
  return {
1040
1099
  min: parseFloat(minFreq.toFixed(2)),
1041
1100
  max: parseFloat(maxFreq.toFixed(2)),
1042
- avg: parseFloat((avgFreq).toFixed(2)),
1101
+ avg: parseFloat(avgFreq.toFixed(2)),
1043
1102
  cores: cores
1044
1103
  };
1045
1104
  } catch (e) {
@@ -1061,7 +1120,6 @@ function getCpuCurrentSpeedSync() {
1061
1120
  }
1062
1121
 
1063
1122
  function cpuCurrentSpeed(callback) {
1064
-
1065
1123
  return new Promise((resolve) => {
1066
1124
  process.nextTick(() => {
1067
1125
  let result = getCpuCurrentSpeedSync();
@@ -1074,7 +1132,9 @@ function cpuCurrentSpeed(callback) {
1074
1132
  cores: []
1075
1133
  };
1076
1134
  }
1077
- if (callback) { callback(result); }
1135
+ if (callback) {
1136
+ callback(result);
1137
+ }
1078
1138
  resolve(result);
1079
1139
  });
1080
1140
  });
@@ -1087,7 +1147,6 @@ exports.cpuCurrentSpeed = cpuCurrentSpeed;
1087
1147
  // if sensors are installed
1088
1148
 
1089
1149
  function cpuTemperature(callback) {
1090
-
1091
1150
  return new Promise((resolve) => {
1092
1151
  process.nextTick(() => {
1093
1152
  let result = {
@@ -1119,7 +1178,8 @@ function cpuTemperature(callback) {
1119
1178
  util.noop();
1120
1179
  }
1121
1180
 
1122
- const cmd = 'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=${label%_*}_input; echo $(cat "$label")___$(cat "$value"); fi; done; done;';
1181
+ const cmd =
1182
+ 'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=${label%_*}_input; echo $(cat "$label")___$(cat "$value"); fi; done; done;';
1123
1183
  try {
1124
1184
  exec(cmd, function (error, stdout) {
1125
1185
  stdout = stdout.toString();
@@ -1129,7 +1189,7 @@ function cpuTemperature(callback) {
1129
1189
  }
1130
1190
  let lines = stdout.split('\n');
1131
1191
  let tctl = 0;
1132
- lines.forEach(line => {
1192
+ lines.forEach((line) => {
1133
1193
  const parts = line.split('___');
1134
1194
  const label = parts[0];
1135
1195
  const value = parts.length > 1 && parts[1] ? parts[1] : '0';
@@ -1151,13 +1211,15 @@ function cpuTemperature(callback) {
1151
1211
  result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1152
1212
  }
1153
1213
  let maxtmp = Math.max.apply(Math, result.cores);
1154
- result.max = (maxtmp > result.main) ? maxtmp : result.main;
1214
+ result.max = maxtmp > result.main ? maxtmp : result.main;
1155
1215
  }
1156
1216
  if (result.main !== null) {
1157
1217
  if (result.max === null) {
1158
1218
  result.max = result.main;
1159
1219
  }
1160
- if (callback) { callback(result); }
1220
+ if (callback) {
1221
+ callback(result);
1222
+ }
1161
1223
  resolve(result);
1162
1224
  return;
1163
1225
  }
@@ -1172,9 +1234,15 @@ function cpuTemperature(callback) {
1172
1234
  if (line.trim() === '') {
1173
1235
  newSectionStarts = true;
1174
1236
  } else if (newSectionStarts) {
1175
- if (line.trim().toLowerCase().startsWith('acpi')) { section = 'acpi'; }
1176
- if (line.trim().toLowerCase().startsWith('pch')) { section = 'pch'; }
1177
- if (line.trim().toLowerCase().startsWith('core')) { section = 'core'; }
1237
+ if (line.trim().toLowerCase().startsWith('acpi')) {
1238
+ section = 'acpi';
1239
+ }
1240
+ if (line.trim().toLowerCase().startsWith('pch')) {
1241
+ section = 'pch';
1242
+ }
1243
+ if (line.trim().toLowerCase().startsWith('core')) {
1244
+ section = 'core';
1245
+ }
1178
1246
  newSectionStarts = false;
1179
1247
  }
1180
1248
  let regex = /[+-]([^°]*)/g;
@@ -1205,7 +1273,7 @@ function cpuTemperature(callback) {
1205
1273
  if (result.cores.length > 0) {
1206
1274
  result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1207
1275
  let maxtmp = Math.max.apply(Math, result.cores);
1208
- result.max = (maxtmp > result.main) ? maxtmp : result.main;
1276
+ result.max = maxtmp > result.main ? maxtmp : result.main;
1209
1277
  } else {
1210
1278
  if (result.main === null && tdieTemp !== null) {
1211
1279
  result.main = tdieTemp;
@@ -1213,7 +1281,9 @@ function cpuTemperature(callback) {
1213
1281
  }
1214
1282
  }
1215
1283
  if (result.main !== null || result.max !== null) {
1216
- if (callback) { callback(result); }
1284
+ if (callback) {
1285
+ callback(result);
1286
+ }
1217
1287
  resolve(result);
1218
1288
  return;
1219
1289
  }
@@ -1228,7 +1298,9 @@ function cpuTemperature(callback) {
1228
1298
  result.max = result.main;
1229
1299
  }
1230
1300
  }
1231
- if (callback) { callback(result); }
1301
+ if (callback) {
1302
+ callback(result);
1303
+ }
1232
1304
  resolve(result);
1233
1305
  });
1234
1306
  } else {
@@ -1240,7 +1312,9 @@ function cpuTemperature(callback) {
1240
1312
  result.max = result.main;
1241
1313
  }
1242
1314
  }
1243
- if (callback) { callback(result); }
1315
+ if (callback) {
1316
+ callback(result);
1317
+ }
1244
1318
  resolve(result);
1245
1319
  });
1246
1320
  }
@@ -1248,7 +1322,9 @@ function cpuTemperature(callback) {
1248
1322
  });
1249
1323
  });
1250
1324
  } catch (er) {
1251
- if (callback) { callback(result); }
1325
+ if (callback) {
1326
+ callback(result);
1327
+ }
1252
1328
  resolve(result);
1253
1329
  }
1254
1330
  }
@@ -1261,16 +1337,20 @@ function cpuTemperature(callback) {
1261
1337
  const parts = line.split(':');
1262
1338
  if (parts.length > 1) {
1263
1339
  const temp = parseFloat(parts[1].replace(',', '.'));
1264
- if (temp > result.max) { result.max = temp; }
1340
+ if (temp > result.max) {
1341
+ result.max = temp;
1342
+ }
1265
1343
  sum = sum + temp;
1266
1344
  result.cores.push(temp);
1267
1345
  }
1268
1346
  });
1269
1347
  if (result.cores.length) {
1270
- result.main = Math.round(sum / result.cores.length * 100) / 100;
1348
+ result.main = Math.round((sum / result.cores.length) * 100) / 100;
1271
1349
  }
1272
1350
  }
1273
- if (callback) { callback(result); }
1351
+ if (callback) {
1352
+ callback(result);
1353
+ }
1274
1354
  resolve(result);
1275
1355
  });
1276
1356
  }
@@ -1297,11 +1377,15 @@ function cpuTemperature(callback) {
1297
1377
  }
1298
1378
  }
1299
1379
 
1300
- if (callback) { callback(result); }
1380
+ if (callback) {
1381
+ callback(result);
1382
+ }
1301
1383
  resolve(result);
1302
1384
  }
1303
1385
  if (_sunos) {
1304
- if (callback) { callback(result); }
1386
+ if (callback) {
1387
+ callback(result);
1388
+ }
1305
1389
  resolve(result);
1306
1390
  }
1307
1391
  if (_windows) {
@@ -1309,12 +1393,17 @@ function cpuTemperature(callback) {
1309
1393
  util.powerShell('Get-CimInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | Select CurrentTemperature').then((stdout, error) => {
1310
1394
  if (!error) {
1311
1395
  let sum = 0;
1312
- let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
1396
+ let lines = stdout
1397
+ .split('\r\n')
1398
+ .filter((line) => line.trim() !== '')
1399
+ .filter((line, idx) => idx > 0);
1313
1400
  lines.forEach(function (line) {
1314
1401
  let value = (parseInt(line, 10) - 2732) / 10;
1315
1402
  if (!isNaN(value)) {
1316
1403
  sum = sum + value;
1317
- if (value > result.max) { result.max = value; }
1404
+ if (value > result.max) {
1405
+ result.max = value;
1406
+ }
1318
1407
  result.cores.push(value);
1319
1408
  }
1320
1409
  });
@@ -1322,11 +1411,15 @@ function cpuTemperature(callback) {
1322
1411
  result.main = sum / result.cores.length;
1323
1412
  }
1324
1413
  }
1325
- if (callback) { callback(result); }
1414
+ if (callback) {
1415
+ callback(result);
1416
+ }
1326
1417
  resolve(result);
1327
1418
  });
1328
1419
  } catch (e) {
1329
- if (callback) { callback(result); }
1420
+ if (callback) {
1421
+ callback(result);
1422
+ }
1330
1423
  resolve(result);
1331
1424
  }
1332
1425
  }
@@ -1340,7 +1433,6 @@ exports.cpuTemperature = cpuTemperature;
1340
1433
  // CPU Flags
1341
1434
 
1342
1435
  function cpuFlags(callback) {
1343
-
1344
1436
  return new Promise((resolve) => {
1345
1437
  process.nextTick(() => {
1346
1438
  let result = '';
@@ -1355,9 +1447,38 @@ function cpuFlags(callback) {
1355
1447
  // as found on wikipedia:
1356
1448
  // https://en.wikipedia.org/wiki/CPUID
1357
1449
  let all_flags = [
1358
- 'fpu', 'vme', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce', 'cx8', 'apic',
1359
- '', 'sep', 'mtrr', 'pge', 'mca', 'cmov', 'pat', 'pse-36', 'psn', 'clfsh',
1360
- '', 'ds', 'acpi', 'mmx', 'fxsr', 'sse', 'sse2', 'ss', 'htt', 'tm', 'ia64', 'pbe'
1450
+ 'fpu',
1451
+ 'vme',
1452
+ 'de',
1453
+ 'pse',
1454
+ 'tsc',
1455
+ 'msr',
1456
+ 'pae',
1457
+ 'mce',
1458
+ 'cx8',
1459
+ 'apic',
1460
+ '',
1461
+ 'sep',
1462
+ 'mtrr',
1463
+ 'pge',
1464
+ 'mca',
1465
+ 'cmov',
1466
+ 'pat',
1467
+ 'pse-36',
1468
+ 'psn',
1469
+ 'clfsh',
1470
+ '',
1471
+ 'ds',
1472
+ 'acpi',
1473
+ 'mmx',
1474
+ 'fxsr',
1475
+ 'sse',
1476
+ 'sse2',
1477
+ 'ss',
1478
+ 'htt',
1479
+ 'tm',
1480
+ 'ia64',
1481
+ 'pbe'
1361
1482
  ];
1362
1483
  for (let f = 0; f < all_flags.length; f++) {
1363
1484
  if (flag_bin[f] === '1' && all_flags[f] !== '') {
@@ -1366,17 +1487,20 @@ function cpuFlags(callback) {
1366
1487
  }
1367
1488
  result = result.trim().toLowerCase();
1368
1489
  }
1369
- if (callback) { callback(result); }
1490
+ if (callback) {
1491
+ callback(result);
1492
+ }
1370
1493
  resolve(result);
1371
1494
  });
1372
1495
  } catch (e) {
1373
- if (callback) { callback(result); }
1496
+ if (callback) {
1497
+ callback(result);
1498
+ }
1374
1499
  resolve(result);
1375
1500
  }
1376
1501
  }
1377
1502
  if (_linux) {
1378
1503
  try {
1379
-
1380
1504
  exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) {
1381
1505
  if (!error) {
1382
1506
  let lines = stdout.toString().split('\n');
@@ -1392,16 +1516,22 @@ function cpuFlags(callback) {
1392
1516
  let lines = stdout.toString().split('\n');
1393
1517
  result = util.getValue(lines, 'features', ':', true).toLowerCase();
1394
1518
  }
1395
- if (callback) { callback(result); }
1519
+ if (callback) {
1520
+ callback(result);
1521
+ }
1396
1522
  resolve(result);
1397
1523
  });
1398
1524
  } else {
1399
- if (callback) { callback(result); }
1525
+ if (callback) {
1526
+ callback(result);
1527
+ }
1400
1528
  resolve(result);
1401
1529
  }
1402
1530
  });
1403
1531
  } catch (e) {
1404
- if (callback) { callback(result); }
1532
+ if (callback) {
1533
+ callback(result);
1534
+ }
1405
1535
  resolve(result);
1406
1536
  }
1407
1537
  }
@@ -1419,7 +1549,9 @@ function cpuFlags(callback) {
1419
1549
  });
1420
1550
  }
1421
1551
  result = flags.join(' ').trim().toLowerCase();
1422
- if (callback) { callback(result); }
1552
+ if (callback) {
1553
+ callback(result);
1554
+ }
1423
1555
  resolve(result);
1424
1556
  });
1425
1557
  }
@@ -1431,12 +1563,16 @@ function cpuFlags(callback) {
1431
1563
  result = lines[0].split(':')[1].trim().toLowerCase();
1432
1564
  }
1433
1565
  }
1434
- if (callback) { callback(result); }
1566
+ if (callback) {
1567
+ callback(result);
1568
+ }
1435
1569
  resolve(result);
1436
1570
  });
1437
1571
  }
1438
1572
  if (_sunos) {
1439
- if (callback) { callback(result); }
1573
+ if (callback) {
1574
+ callback(result);
1575
+ }
1440
1576
  resolve(result);
1441
1577
  }
1442
1578
  });
@@ -1449,15 +1585,13 @@ exports.cpuFlags = cpuFlags;
1449
1585
  // CPU Cache
1450
1586
 
1451
1587
  function cpuCache(callback) {
1452
-
1453
1588
  return new Promise((resolve) => {
1454
1589
  process.nextTick(() => {
1455
-
1456
1590
  let result = {
1457
1591
  l1d: null,
1458
1592
  l1i: null,
1459
1593
  l2: null,
1460
- l3: null,
1594
+ l3: null
1461
1595
  };
1462
1596
  if (_linux) {
1463
1597
  try {
@@ -1467,24 +1601,28 @@ function cpuCache(callback) {
1467
1601
  lines.forEach(function (line) {
1468
1602
  let parts = line.split(':');
1469
1603
  if (parts[0].toUpperCase().indexOf('L1D CACHE') !== -1) {
1470
- result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
1604
+ result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : parts[1].indexOf('K') !== -1 ? 1024 : 1);
1471
1605
  }
1472
1606
  if (parts[0].toUpperCase().indexOf('L1I CACHE') !== -1) {
1473
- result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
1607
+ result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : parts[1].indexOf('K') !== -1 ? 1024 : 1);
1474
1608
  }
1475
1609
  if (parts[0].toUpperCase().indexOf('L2 CACHE') !== -1) {
1476
- result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
1610
+ result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : parts[1].indexOf('K') !== -1 ? 1024 : 1);
1477
1611
  }
1478
1612
  if (parts[0].toUpperCase().indexOf('L3 CACHE') !== -1) {
1479
- result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
1613
+ result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : parts[1].indexOf('K') !== -1 ? 1024 : 1);
1480
1614
  }
1481
1615
  });
1482
1616
  }
1483
- if (callback) { callback(result); }
1617
+ if (callback) {
1618
+ callback(result);
1619
+ }
1484
1620
  resolve(result);
1485
1621
  });
1486
1622
  } catch (e) {
1487
- if (callback) { callback(result); }
1623
+ if (callback) {
1624
+ callback(result);
1625
+ }
1488
1626
  resolve(result);
1489
1627
  }
1490
1628
  }
@@ -1503,7 +1641,7 @@ function cpuCache(callback) {
1503
1641
  const sizeParts = util.getValue(lines, 'Installed Size').split(' ');
1504
1642
  let size = parseInt(sizeParts[0], 10);
1505
1643
  const unit = sizeParts.length > 1 ? sizeParts[1] : 'kb';
1506
- size = size * (unit === 'kb' ? 1024 : (unit === 'mb' ? 1024 * 1024 : (unit === 'gb' ? 1024 * 1024 * 1024 : 1)));
1644
+ size = size * (unit === 'kb' ? 1024 : unit === 'mb' ? 1024 * 1024 : unit === 'gb' ? 1024 * 1024 * 1024 : 1);
1507
1645
  if (cacheType) {
1508
1646
  if (cacheType === 'l1') {
1509
1647
  result.cache[cacheType + 'd'] = size / 2;
@@ -1513,7 +1651,9 @@ function cpuCache(callback) {
1513
1651
  }
1514
1652
  }
1515
1653
  }
1516
- if (callback) { callback(result); }
1654
+ if (callback) {
1655
+ callback(result);
1656
+ }
1517
1657
  resolve(result);
1518
1658
  });
1519
1659
  }
@@ -1537,12 +1677,16 @@ function cpuCache(callback) {
1537
1677
  }
1538
1678
  });
1539
1679
  }
1540
- if (callback) { callback(result); }
1680
+ if (callback) {
1681
+ callback(result);
1682
+ }
1541
1683
  resolve(result);
1542
1684
  });
1543
1685
  }
1544
1686
  if (_sunos) {
1545
- if (callback) { callback(result); }
1687
+ if (callback) {
1688
+ callback(result);
1689
+ }
1546
1690
  resolve(result);
1547
1691
  }
1548
1692
  if (_windows) {
@@ -1551,16 +1695,18 @@ function cpuCache(callback) {
1551
1695
  workload.push(util.powerShell('Get-CimInstance Win32_processor | select L2CacheSize, L3CacheSize | fl'));
1552
1696
  workload.push(util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl'));
1553
1697
 
1554
- Promise.all(
1555
- workload
1556
- ).then((data) => {
1698
+ Promise.all(workload).then((data) => {
1557
1699
  result = parseWinCache(data[0], data[1]);
1558
1700
 
1559
- if (callback) { callback(result); }
1701
+ if (callback) {
1702
+ callback(result);
1703
+ }
1560
1704
  resolve(result);
1561
1705
  });
1562
1706
  } catch (e) {
1563
- if (callback) { callback(result); }
1707
+ if (callback) {
1708
+ callback(result);
1709
+ }
1564
1710
  resolve(result);
1565
1711
  }
1566
1712
  }
@@ -1573,7 +1719,7 @@ function parseWinCache(linesProc, linesCache) {
1573
1719
  l1d: null,
1574
1720
  l1i: null,
1575
1721
  l2: null,
1576
- l3: null,
1722
+ l3: null
1577
1723
  };
1578
1724
 
1579
1725
  // Win32_processor
@@ -1582,8 +1728,16 @@ function parseWinCache(linesProc, linesCache) {
1582
1728
  result.l1i = 0;
1583
1729
  result.l2 = util.getValue(lines, 'l2cachesize', ':');
1584
1730
  result.l3 = util.getValue(lines, 'l3cachesize', ':');
1585
- if (result.l2) { result.l2 = parseInt(result.l2, 10) * 1024; } else { result.l2 = 0; }
1586
- if (result.l3) { result.l3 = parseInt(result.l3, 10) * 1024; } else { result.l3 = 0; }
1731
+ if (result.l2) {
1732
+ result.l2 = parseInt(result.l2, 10) * 1024;
1733
+ } else {
1734
+ result.l2 = 0;
1735
+ }
1736
+ if (result.l3) {
1737
+ result.l3 = parseInt(result.l3, 10) * 1024;
1738
+ } else {
1739
+ result.l3 = 0;
1740
+ }
1587
1741
 
1588
1742
  // Win32_CacheMemory
1589
1743
  const parts = linesCache.split(/\n\s*\n/);
@@ -1629,11 +1783,12 @@ exports.cpuCache = cpuCache;
1629
1783
  // CPU - current load - in %
1630
1784
 
1631
1785
  function getLoad() {
1632
-
1633
1786
  return new Promise((resolve) => {
1634
1787
  process.nextTick(() => {
1635
- let loads = os.loadavg().map(function (x) { return x / util.cores(); });
1636
- let avgLoad = parseFloat((Math.max.apply(Math, loads)).toFixed(2));
1788
+ let loads = os.loadavg().map(function (x) {
1789
+ return x / util.cores();
1790
+ });
1791
+ let avgLoad = parseFloat(Math.max.apply(Math, loads).toFixed(2));
1637
1792
  let result = {};
1638
1793
 
1639
1794
  let now = Date.now() - _current_cpu.ms;
@@ -1652,7 +1807,7 @@ function getLoad() {
1652
1807
  let totalSteal = 0;
1653
1808
  let totalGuest = 0;
1654
1809
  let cores = [];
1655
- _corecount = (cpus && cpus.length) ? cpus.length : 0;
1810
+ _corecount = cpus && cpus.length ? cpus.length : 0;
1656
1811
 
1657
1812
  // linux: try to get other cpu stats
1658
1813
  if (_linux) {
@@ -1686,36 +1841,36 @@ function getLoad() {
1686
1841
  totalIrq += cpu.irq;
1687
1842
  totalSteal += cpu.steal || 0;
1688
1843
  totalGuest += cpu.guest || 0;
1689
- let tmpTick = (_cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0);
1690
- let tmpLoad = (_cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0);
1691
- let tmpUser = (_cpus && _cpus[i] && _cpus[i].user ? _cpus[i].user : 0);
1692
- let tmpSystem = (_cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0);
1693
- let tmpNice = (_cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0);
1694
- let tmpIdle = (_cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0);
1695
- let tmpIrq = (_cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0);
1696
- let tmpSteal = (_cpus && _cpus[i] && _cpus[i].steal ? _cpus[i].steal : 0);
1697
- let tmpGuest = (_cpus && _cpus[i] && _cpus[i].guest ? _cpus[i].guest : 0);
1844
+ let tmpTick = _cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0;
1845
+ let tmpLoad = _cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0;
1846
+ let tmpUser = _cpus && _cpus[i] && _cpus[i].user ? _cpus[i].user : 0;
1847
+ let tmpSystem = _cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0;
1848
+ let tmpNice = _cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0;
1849
+ let tmpIdle = _cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0;
1850
+ let tmpIrq = _cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0;
1851
+ let tmpSteal = _cpus && _cpus[i] && _cpus[i].steal ? _cpus[i].steal : 0;
1852
+ let tmpGuest = _cpus && _cpus[i] && _cpus[i].guest ? _cpus[i].guest : 0;
1698
1853
  _cpus[i] = cpu;
1699
1854
  _cpus[i].totalTick = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest + _cpus[i].idle;
1700
1855
  _cpus[i].totalLoad = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest;
1701
1856
  _cpus[i].currentTick = _cpus[i].totalTick - tmpTick;
1702
- _cpus[i].load = (_cpus[i].totalLoad - tmpLoad);
1703
- _cpus[i].loadUser = (_cpus[i].user - tmpUser);
1704
- _cpus[i].loadSystem = (_cpus[i].sys - tmpSystem);
1705
- _cpus[i].loadNice = (_cpus[i].nice - tmpNice);
1706
- _cpus[i].loadIdle = (_cpus[i].idle - tmpIdle);
1707
- _cpus[i].loadIrq = (_cpus[i].irq - tmpIrq);
1708
- _cpus[i].loadSteal = (_cpus[i].steal - tmpSteal);
1709
- _cpus[i].loadGuest = (_cpus[i].guest - tmpGuest);
1857
+ _cpus[i].load = _cpus[i].totalLoad - tmpLoad;
1858
+ _cpus[i].loadUser = _cpus[i].user - tmpUser;
1859
+ _cpus[i].loadSystem = _cpus[i].sys - tmpSystem;
1860
+ _cpus[i].loadNice = _cpus[i].nice - tmpNice;
1861
+ _cpus[i].loadIdle = _cpus[i].idle - tmpIdle;
1862
+ _cpus[i].loadIrq = _cpus[i].irq - tmpIrq;
1863
+ _cpus[i].loadSteal = _cpus[i].steal - tmpSteal;
1864
+ _cpus[i].loadGuest = _cpus[i].guest - tmpGuest;
1710
1865
  cores[i] = {};
1711
- cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100;
1712
- cores[i].loadUser = _cpus[i].loadUser / _cpus[i].currentTick * 100;
1713
- cores[i].loadSystem = _cpus[i].loadSystem / _cpus[i].currentTick * 100;
1714
- cores[i].loadNice = _cpus[i].loadNice / _cpus[i].currentTick * 100;
1715
- cores[i].loadIdle = _cpus[i].loadIdle / _cpus[i].currentTick * 100;
1716
- cores[i].loadIrq = _cpus[i].loadIrq / _cpus[i].currentTick * 100;
1717
- cores[i].loadSteal = _cpus[i].loadSteal / _cpus[i].currentTick * 100;
1718
- cores[i].loadGuest = _cpus[i].loadGuest / _cpus[i].currentTick * 100;
1866
+ cores[i].load = (_cpus[i].load / _cpus[i].currentTick) * 100;
1867
+ cores[i].loadUser = (_cpus[i].loadUser / _cpus[i].currentTick) * 100;
1868
+ cores[i].loadSystem = (_cpus[i].loadSystem / _cpus[i].currentTick) * 100;
1869
+ cores[i].loadNice = (_cpus[i].loadNice / _cpus[i].currentTick) * 100;
1870
+ cores[i].loadIdle = (_cpus[i].loadIdle / _cpus[i].currentTick) * 100;
1871
+ cores[i].loadIrq = (_cpus[i].loadIrq / _cpus[i].currentTick) * 100;
1872
+ cores[i].loadSteal = (_cpus[i].loadSteal / _cpus[i].currentTick) * 100;
1873
+ cores[i].loadGuest = (_cpus[i].loadGuest / _cpus[i].currentTick) * 100;
1719
1874
  cores[i].rawLoad = _cpus[i].load;
1720
1875
  cores[i].rawLoadUser = _cpus[i].loadUser;
1721
1876
  cores[i].rawLoadSystem = _cpus[i].loadSystem;
@@ -1730,22 +1885,22 @@ function getLoad() {
1730
1885
  let currentTick = totalTick - _current_cpu.tick;
1731
1886
  result = {
1732
1887
  avgLoad: avgLoad,
1733
- currentLoad: (totalLoad - _current_cpu.load) / currentTick * 100,
1734
- currentLoadUser: (totalUser - _current_cpu.user) / currentTick * 100,
1735
- currentLoadSystem: (totalSystem - _current_cpu.system) / currentTick * 100,
1736
- currentLoadNice: (totalNice - _current_cpu.nice) / currentTick * 100,
1737
- currentLoadIdle: (totalIdle - _current_cpu.idle) / currentTick * 100,
1738
- currentLoadIrq: (totalIrq - _current_cpu.irq) / currentTick * 100,
1739
- currentLoadSteal: (totalSteal - _current_cpu.steal) / currentTick * 100,
1740
- currentLoadGuest: (totalGuest - _current_cpu.guest) / currentTick * 100,
1741
- rawCurrentLoad: (totalLoad - _current_cpu.load),
1742
- rawCurrentLoadUser: (totalUser - _current_cpu.user),
1743
- rawCurrentLoadSystem: (totalSystem - _current_cpu.system),
1744
- rawCurrentLoadNice: (totalNice - _current_cpu.nice),
1745
- rawCurrentLoadIdle: (totalIdle - _current_cpu.idle),
1746
- rawCurrentLoadIrq: (totalIrq - _current_cpu.irq),
1747
- rawCurrentLoadSteal: (totalSteal - _current_cpu.steal),
1748
- rawCurrentLoadGuest: (totalGuest - _current_cpu.guest),
1888
+ currentLoad: ((totalLoad - _current_cpu.load) / currentTick) * 100,
1889
+ currentLoadUser: ((totalUser - _current_cpu.user) / currentTick) * 100,
1890
+ currentLoadSystem: ((totalSystem - _current_cpu.system) / currentTick) * 100,
1891
+ currentLoadNice: ((totalNice - _current_cpu.nice) / currentTick) * 100,
1892
+ currentLoadIdle: ((totalIdle - _current_cpu.idle) / currentTick) * 100,
1893
+ currentLoadIrq: ((totalIrq - _current_cpu.irq) / currentTick) * 100,
1894
+ currentLoadSteal: ((totalSteal - _current_cpu.steal) / currentTick) * 100,
1895
+ currentLoadGuest: ((totalGuest - _current_cpu.guest) / currentTick) * 100,
1896
+ rawCurrentLoad: totalLoad - _current_cpu.load,
1897
+ rawCurrentLoadUser: totalUser - _current_cpu.user,
1898
+ rawCurrentLoadSystem: totalSystem - _current_cpu.system,
1899
+ rawCurrentLoadNice: totalNice - _current_cpu.nice,
1900
+ rawCurrentLoadIdle: totalIdle - _current_cpu.idle,
1901
+ rawCurrentLoadIrq: totalIrq - _current_cpu.irq,
1902
+ rawCurrentLoadSteal: totalSteal - _current_cpu.steal,
1903
+ rawCurrentLoadGuest: totalGuest - _current_cpu.guest,
1749
1904
  cpus: cores
1750
1905
  };
1751
1906
  _current_cpu = {
@@ -1774,18 +1929,18 @@ function getLoad() {
1774
1929
  rawCurrentLoadIdle: result.rawCurrentLoadIdle,
1775
1930
  rawCurrentLoadIrq: result.rawCurrentLoadIrq,
1776
1931
  rawCurrentLoadSteal: result.rawCurrentLoadSteal,
1777
- rawCurrentLoadGuest: result.rawCurrentLoadGuest,
1932
+ rawCurrentLoadGuest: result.rawCurrentLoadGuest
1778
1933
  };
1779
1934
  } else {
1780
1935
  let cores = [];
1781
1936
  for (let i = 0; i < _corecount; i++) {
1782
1937
  cores[i] = {};
1783
- cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100;
1784
- cores[i].loadUser = _cpus[i].loadUser / _cpus[i].currentTick * 100;
1785
- cores[i].loadSystem = _cpus[i].loadSystem / _cpus[i].currentTick * 100;
1786
- cores[i].loadNice = _cpus[i].loadNice / _cpus[i].currentTick * 100;
1787
- cores[i].loadIdle = _cpus[i].loadIdle / _cpus[i].currentTick * 100;
1788
- cores[i].loadIrq = _cpus[i].loadIrq / _cpus[i].currentTick * 100;
1938
+ cores[i].load = (_cpus[i].load / _cpus[i].currentTick) * 100;
1939
+ cores[i].loadUser = (_cpus[i].loadUser / _cpus[i].currentTick) * 100;
1940
+ cores[i].loadSystem = (_cpus[i].loadSystem / _cpus[i].currentTick) * 100;
1941
+ cores[i].loadNice = (_cpus[i].loadNice / _cpus[i].currentTick) * 100;
1942
+ cores[i].loadIdle = (_cpus[i].loadIdle / _cpus[i].currentTick) * 100;
1943
+ cores[i].loadIrq = (_cpus[i].loadIrq / _cpus[i].currentTick) * 100;
1789
1944
  cores[i].rawLoad = _cpus[i].load;
1790
1945
  cores[i].rawLoadUser = _cpus[i].loadUser;
1791
1946
  cores[i].rawLoadSystem = _cpus[i].loadSystem;
@@ -1822,11 +1977,12 @@ function getLoad() {
1822
1977
  }
1823
1978
 
1824
1979
  function currentLoad(callback) {
1825
-
1826
1980
  return new Promise((resolve) => {
1827
1981
  process.nextTick(() => {
1828
- getLoad().then(result => {
1829
- if (callback) { callback(result); }
1982
+ getLoad().then((result) => {
1983
+ if (callback) {
1984
+ callback(result);
1985
+ }
1830
1986
  resolve(result);
1831
1987
  });
1832
1988
  });
@@ -1840,10 +1996,8 @@ exports.currentLoad = currentLoad;
1840
1996
  // since bootup
1841
1997
 
1842
1998
  function getFullLoad() {
1843
-
1844
1999
  return new Promise((resolve) => {
1845
2000
  process.nextTick(() => {
1846
-
1847
2001
  const cpus = os.cpus();
1848
2002
  let totalUser = 0;
1849
2003
  let totalSystem = 0;
@@ -1863,8 +2017,7 @@ function getFullLoad() {
1863
2017
  totalIdle += cpu.idle;
1864
2018
  }
1865
2019
  let totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser;
1866
- result = (totalTicks - totalIdle) / totalTicks * 100.0;
1867
-
2020
+ result = ((totalTicks - totalIdle) / totalTicks) * 100.0;
1868
2021
  }
1869
2022
  resolve(result);
1870
2023
  });
@@ -1872,11 +2025,12 @@ function getFullLoad() {
1872
2025
  }
1873
2026
 
1874
2027
  function fullLoad(callback) {
1875
-
1876
2028
  return new Promise((resolve) => {
1877
2029
  process.nextTick(() => {
1878
- getFullLoad().then(result => {
1879
- if (callback) { callback(result); }
2030
+ getFullLoad().then((result) => {
2031
+ if (callback) {
2032
+ callback(result);
2033
+ }
1880
2034
  resolve(result);
1881
2035
  });
1882
2036
  });