systeminformation 5.33.3 → 6.0.0-beta.0

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 (494) hide show
  1. package/README.md +873 -957
  2. package/dist/audio.d.ts +1 -0
  3. package/dist/audio.js +18 -0
  4. package/dist/baseboard.d.ts +1 -0
  5. package/dist/baseboard.js +17 -0
  6. package/dist/battery.d.ts +1 -0
  7. package/dist/battery.js +19 -0
  8. package/dist/bios.d.ts +1 -0
  9. package/dist/bios.js +17 -0
  10. package/dist/block-devices.d.ts +1 -0
  11. package/dist/block-devices.js +17 -0
  12. package/dist/bluetooth.d.ts +1 -0
  13. package/dist/bluetooth.js +17 -0
  14. package/dist/bsd/battery.d.ts +2 -0
  15. package/dist/bsd/battery.js +27 -0
  16. package/dist/bsd/cpu-cache.d.ts +1 -0
  17. package/dist/bsd/cpu-cache.js +37 -0
  18. package/dist/bsd/cpu-flags.d.ts +1 -0
  19. package/dist/bsd/cpu-flags.js +28 -0
  20. package/dist/bsd/cpu-temperature.d.ts +1 -0
  21. package/dist/bsd/cpu-temperature.js +29 -0
  22. package/dist/bsd/cpu.d.ts +1 -0
  23. package/dist/bsd/cpu.js +98 -0
  24. package/dist/bsd/index.d.ts +38 -0
  25. package/dist/bsd/index.js +85 -0
  26. package/dist/bsd/mem.d.ts +1 -0
  27. package/dist/bsd/mem.js +37 -0
  28. package/dist/bsd/network-stats.d.ts +2 -0
  29. package/dist/bsd/network-stats.js +92 -0
  30. package/dist/bsd/os-info.d.ts +21 -0
  31. package/dist/bsd/os-info.js +38 -0
  32. package/dist/bsd/uuid.d.ts +2 -0
  33. package/dist/bsd/uuid.js +30 -0
  34. package/dist/camera.d.ts +1 -0
  35. package/dist/camera.js +17 -0
  36. package/dist/chassis.d.ts +1 -0
  37. package/dist/chassis.js +17 -0
  38. package/dist/cli.d.ts +2 -0
  39. package/dist/cli.js +107 -0
  40. package/dist/common/codepage.d.ts +1 -0
  41. package/dist/common/codepage.js +43 -0
  42. package/dist/common/const.d.ts +25 -0
  43. package/dist/common/const.js +26 -0
  44. package/dist/common/cpu.d.ts +2 -0
  45. package/dist/common/cpu.js +12 -0
  46. package/dist/common/darwin.d.ts +6 -0
  47. package/dist/common/darwin.js +266 -0
  48. package/dist/common/datetime.d.ts +9 -0
  49. package/dist/common/datetime.js +161 -0
  50. package/dist/common/defaults.d.ts +25 -0
  51. package/dist/common/defaults.js +299 -0
  52. package/dist/common/exec.d.ts +10 -0
  53. package/dist/common/exec.js +69 -0
  54. package/dist/common/files.d.ts +2 -0
  55. package/dist/common/files.js +39 -0
  56. package/dist/common/filesys.d.ts +11 -0
  57. package/dist/common/filesys.js +282 -0
  58. package/dist/common/host.d.ts +2 -0
  59. package/dist/common/host.js +67 -0
  60. package/dist/common/index.d.ts +12 -0
  61. package/dist/common/index.js +146 -0
  62. package/dist/common/internet.d.ts +1 -0
  63. package/dist/common/internet.js +47 -0
  64. package/dist/common/mappings.d.ts +55 -0
  65. package/dist/common/mappings.js +4133 -0
  66. package/dist/common/network.d.ts +8 -0
  67. package/dist/common/network.js +162 -0
  68. package/dist/common/nvidia.d.ts +22 -0
  69. package/dist/common/nvidia.js +159 -0
  70. package/dist/common/parse.d.ts +13 -0
  71. package/dist/common/parse.js +157 -0
  72. package/dist/common/raspberry.d.ts +5 -0
  73. package/dist/common/raspberry.js +277 -0
  74. package/dist/common/security.d.ts +31 -0
  75. package/dist/common/security.js +241 -0
  76. package/dist/common/types.d.ts +992 -0
  77. package/dist/common/types.js +2 -0
  78. package/dist/common/windows.d.ts +58 -0
  79. package/dist/common/windows.js +292 -0
  80. package/dist/cpu-cache.d.ts +1 -0
  81. package/dist/cpu-cache.js +19 -0
  82. package/dist/cpu-current-load.d.ts +2 -0
  83. package/dist/cpu-current-load.js +249 -0
  84. package/dist/cpu-current-speed.d.ts +3 -0
  85. package/dist/cpu-current-speed.js +84 -0
  86. package/dist/cpu-flags.d.ts +1 -0
  87. package/dist/cpu-flags.js +19 -0
  88. package/dist/cpu-full-load.d.ts +1 -0
  89. package/dist/cpu-full-load.js +30 -0
  90. package/dist/cpu-temperature.d.ts +1 -0
  91. package/dist/cpu-temperature.js +19 -0
  92. package/dist/cpu.d.ts +1 -0
  93. package/dist/cpu.js +19 -0
  94. package/dist/darwin/audio.d.ts +2 -0
  95. package/dist/darwin/audio.js +46 -0
  96. package/dist/darwin/baseboard.d.ts +1 -0
  97. package/dist/darwin/baseboard.js +48 -0
  98. package/dist/darwin/battery.d.ts +2 -0
  99. package/dist/darwin/battery.js +65 -0
  100. package/dist/darwin/bios.d.ts +1 -0
  101. package/dist/darwin/bios.js +45 -0
  102. package/dist/darwin/block-devices.d.ts +2 -0
  103. package/dist/darwin/block-devices.js +101 -0
  104. package/dist/darwin/bluetooth.d.ts +3 -0
  105. package/dist/darwin/bluetooth.js +84 -0
  106. package/dist/darwin/camera.d.ts +2 -0
  107. package/dist/darwin/camera.js +55 -0
  108. package/dist/darwin/chassis.d.ts +2 -0
  109. package/dist/darwin/chassis.js +32 -0
  110. package/dist/darwin/cpu-cache.d.ts +2 -0
  111. package/dist/darwin/cpu-cache.js +29 -0
  112. package/dist/darwin/cpu-flags.d.ts +1 -0
  113. package/dist/darwin/cpu-flags.js +16 -0
  114. package/dist/darwin/cpu-temperature.d.ts +1 -0
  115. package/dist/darwin/cpu-temperature.js +44 -0
  116. package/dist/darwin/cpu.d.ts +1 -0
  117. package/dist/darwin/cpu.js +69 -0
  118. package/dist/darwin/disk-layout.d.ts +2 -0
  119. package/dist/darwin/disk-layout.js +231 -0
  120. package/dist/darwin/disks-io.d.ts +2 -0
  121. package/dist/darwin/disks-io.js +56 -0
  122. package/dist/darwin/displays.d.ts +2 -0
  123. package/dist/darwin/displays.js +98 -0
  124. package/dist/darwin/fs-open-files.d.ts +2 -0
  125. package/dist/darwin/fs-open-files.js +27 -0
  126. package/dist/darwin/fs-stats.d.ts +2 -0
  127. package/dist/darwin/fs-stats.js +47 -0
  128. package/dist/darwin/gpu.d.ts +2 -0
  129. package/dist/darwin/gpu.js +55 -0
  130. package/dist/darwin/index.d.ts +56 -0
  131. package/dist/darwin/index.js +122 -0
  132. package/dist/darwin/keyboard.d.ts +2 -0
  133. package/dist/darwin/keyboard.js +73 -0
  134. package/dist/darwin/mem-layout.d.ts +2 -0
  135. package/dist/darwin/mem-layout.js +60 -0
  136. package/dist/darwin/mem.d.ts +2 -0
  137. package/dist/darwin/mem.js +50 -0
  138. package/dist/darwin/mouse.d.ts +2 -0
  139. package/dist/darwin/mouse.js +78 -0
  140. package/dist/darwin/network-connections.d.ts +2 -0
  141. package/dist/darwin/network-connections.js +98 -0
  142. package/dist/darwin/network-gateway-default.d.ts +1 -0
  143. package/dist/darwin/network-gateway-default.js +26 -0
  144. package/dist/darwin/network-interface-default.d.ts +2 -0
  145. package/dist/darwin/network-interface-default.js +41 -0
  146. package/dist/darwin/network-interfaces.d.ts +2 -0
  147. package/dist/darwin/network-interfaces.js +205 -0
  148. package/dist/darwin/network-stats.d.ts +2 -0
  149. package/dist/darwin/network-stats.js +86 -0
  150. package/dist/darwin/npm.d.ts +1 -0
  151. package/dist/darwin/npm.js +5 -0
  152. package/dist/darwin/npu.d.ts +2 -0
  153. package/dist/darwin/npu.js +41 -0
  154. package/dist/darwin/os-info.d.ts +1 -0
  155. package/dist/darwin/os-info.js +110 -0
  156. package/dist/darwin/pci.d.ts +2 -0
  157. package/dist/darwin/pci.js +37 -0
  158. package/dist/darwin/printer.d.ts +2 -0
  159. package/dist/darwin/printer.js +45 -0
  160. package/dist/darwin/software.d.ts +2 -0
  161. package/dist/darwin/software.js +39 -0
  162. package/dist/darwin/system.d.ts +1 -0
  163. package/dist/darwin/system.js +29 -0
  164. package/dist/darwin/thunderbolt.d.ts +1 -0
  165. package/dist/darwin/thunderbolt.js +53 -0
  166. package/dist/darwin/usb.d.ts +3 -0
  167. package/dist/darwin/usb.js +69 -0
  168. package/dist/darwin/users.d.ts +2 -0
  169. package/dist/darwin/users.js +13 -0
  170. package/dist/darwin/uuid.d.ts +2 -0
  171. package/dist/darwin/uuid.js +39 -0
  172. package/dist/darwin/wifi-connections.d.ts +2 -0
  173. package/dist/darwin/wifi-connections.js +60 -0
  174. package/dist/darwin/wifi-interfaces.d.ts +2 -0
  175. package/dist/darwin/wifi-interfaces.js +27 -0
  176. package/dist/darwin/wifi-networks.d.ts +2 -0
  177. package/dist/darwin/wifi-networks.js +61 -0
  178. package/dist/disk-layout.d.ts +1 -0
  179. package/dist/disk-layout.js +17 -0
  180. package/dist/disks-io.d.ts +1 -0
  181. package/dist/disks-io.js +17 -0
  182. package/dist/displays.d.ts +1 -0
  183. package/dist/displays.js +17 -0
  184. package/dist/docker-socket.d.ts +11 -0
  185. package/dist/docker-socket.js +113 -0
  186. package/dist/docker.d.ts +102 -0
  187. package/dist/docker.js +532 -0
  188. package/dist/fs-open-files.d.ts +1 -0
  189. package/dist/fs-open-files.js +17 -0
  190. package/dist/fs-size.d.ts +1 -0
  191. package/dist/fs-size.js +23 -0
  192. package/dist/fs-stats.d.ts +1 -0
  193. package/dist/fs-stats.js +17 -0
  194. package/dist/get-data.d.ts +110 -0
  195. package/dist/get-data.js +151 -0
  196. package/dist/get.d.ts +5 -0
  197. package/dist/get.js +117 -0
  198. package/dist/gpu.d.ts +1 -0
  199. package/dist/gpu.js +17 -0
  200. package/dist/index.d.ts +59 -0
  201. package/dist/index.js +130 -0
  202. package/dist/inet-checksite.d.ts +1 -0
  203. package/dist/inet-checksite.js +11 -0
  204. package/dist/inet-latency.d.ts +1 -0
  205. package/dist/inet-latency.js +17 -0
  206. package/dist/keyboard.d.ts +1 -0
  207. package/dist/keyboard.js +17 -0
  208. package/dist/linux/audio.d.ts +2 -0
  209. package/dist/linux/audio.js +67 -0
  210. package/dist/linux/baseboard.d.ts +1 -0
  211. package/dist/linux/baseboard.js +81 -0
  212. package/dist/linux/battery.d.ts +2 -0
  213. package/dist/linux/battery.js +88 -0
  214. package/dist/linux/bios.d.ts +2 -0
  215. package/dist/linux/bios.js +55 -0
  216. package/dist/linux/block-devices.d.ts +2 -0
  217. package/dist/linux/block-devices.js +30 -0
  218. package/dist/linux/bluetooth.d.ts +2 -0
  219. package/dist/linux/bluetooth.js +86 -0
  220. package/dist/linux/camera.d.ts +2 -0
  221. package/dist/linux/camera.js +63 -0
  222. package/dist/linux/chassis.d.ts +1 -0
  223. package/dist/linux/chassis.js +41 -0
  224. package/dist/linux/cpu-cache.d.ts +1 -0
  225. package/dist/linux/cpu-cache.js +35 -0
  226. package/dist/linux/cpu-flags.d.ts +1 -0
  227. package/dist/linux/cpu-flags.js +33 -0
  228. package/dist/linux/cpu-temperature.d.ts +1 -0
  229. package/dist/linux/cpu-temperature.js +179 -0
  230. package/dist/linux/cpu.d.ts +1 -0
  231. package/dist/linux/cpu.js +135 -0
  232. package/dist/linux/disk-layout.d.ts +2 -0
  233. package/dist/linux/disk-layout.js +151 -0
  234. package/dist/linux/disks-io.d.ts +2 -0
  235. package/dist/linux/disks-io.js +58 -0
  236. package/dist/linux/displays.d.ts +2 -0
  237. package/dist/linux/displays.js +193 -0
  238. package/dist/linux/fs-open-files.d.ts +2 -0
  239. package/dist/linux/fs-open-files.js +44 -0
  240. package/dist/linux/fs-size.d.ts +2 -0
  241. package/dist/linux/fs-size.js +157 -0
  242. package/dist/linux/fs-stats.d.ts +2 -0
  243. package/dist/linux/fs-stats.js +65 -0
  244. package/dist/linux/gpu.d.ts +2 -0
  245. package/dist/linux/gpu.js +273 -0
  246. package/dist/linux/index.d.ts +56 -0
  247. package/dist/linux/index.js +122 -0
  248. package/dist/linux/inet-latency.d.ts +1 -0
  249. package/dist/linux/inet-latency.js +39 -0
  250. package/dist/linux/keyboard.d.ts +2 -0
  251. package/dist/linux/keyboard.js +61 -0
  252. package/dist/linux/mem-layout.d.ts +2 -0
  253. package/dist/linux/mem-layout.js +112 -0
  254. package/dist/linux/mem.d.ts +2 -0
  255. package/dist/linux/mem.js +61 -0
  256. package/dist/linux/mouse.d.ts +2 -0
  257. package/dist/linux/mouse.js +73 -0
  258. package/dist/linux/network-connections.d.ts +2 -0
  259. package/dist/linux/network-connections.js +114 -0
  260. package/dist/linux/network-gateway-default.d.ts +1 -0
  261. package/dist/linux/network-gateway-default.js +22 -0
  262. package/dist/linux/network-interface-default.d.ts +2 -0
  263. package/dist/linux/network-interface-default.js +46 -0
  264. package/dist/linux/network-interfaces.d.ts +3 -0
  265. package/dist/linux/network-interfaces.js +353 -0
  266. package/dist/linux/network-stats.d.ts +2 -0
  267. package/dist/linux/network-stats.js +99 -0
  268. package/dist/linux/npm.d.ts +1 -0
  269. package/dist/linux/npm.js +5 -0
  270. package/dist/linux/npu.d.ts +2 -0
  271. package/dist/linux/npu.js +77 -0
  272. package/dist/linux/os-info.d.ts +1 -0
  273. package/dist/linux/os-info.js +104 -0
  274. package/dist/linux/pci.d.ts +2 -0
  275. package/dist/linux/pci.js +56 -0
  276. package/dist/linux/printer.d.ts +2 -0
  277. package/dist/linux/printer.js +80 -0
  278. package/dist/linux/process-load.d.ts +2 -0
  279. package/dist/linux/process-load.js +164 -0
  280. package/dist/linux/processes.d.ts +2 -0
  281. package/dist/linux/processes.js +358 -0
  282. package/dist/linux/services.d.ts +2 -0
  283. package/dist/linux/services.js +222 -0
  284. package/dist/linux/software.d.ts +2 -0
  285. package/dist/linux/software.js +110 -0
  286. package/dist/linux/system.d.ts +1 -0
  287. package/dist/linux/system.js +186 -0
  288. package/dist/linux/thunderbolt.d.ts +2 -0
  289. package/dist/linux/thunderbolt.js +51 -0
  290. package/dist/linux/time.d.ts +6 -0
  291. package/dist/linux/time.js +28 -0
  292. package/dist/linux/usb.d.ts +2 -0
  293. package/dist/linux/usb.js +62 -0
  294. package/dist/linux/users.d.ts +2 -0
  295. package/dist/linux/users.js +102 -0
  296. package/dist/linux/uuid.d.ts +2 -0
  297. package/dist/linux/uuid.js +44 -0
  298. package/dist/linux/wifi-connections.d.ts +2 -0
  299. package/dist/linux/wifi-connections.js +196 -0
  300. package/dist/linux/wifi-interfaces.d.ts +2 -0
  301. package/dist/linux/wifi-interfaces.js +96 -0
  302. package/dist/linux/wifi-networks.d.ts +2 -0
  303. package/dist/linux/wifi-networks.js +176 -0
  304. package/dist/mem-layout.d.ts +1 -0
  305. package/dist/mem-layout.js +17 -0
  306. package/dist/mem.d.ts +1 -0
  307. package/dist/mem.js +19 -0
  308. package/dist/mouse.d.ts +1 -0
  309. package/dist/mouse.js +17 -0
  310. package/dist/network-connections.d.ts +1 -0
  311. package/dist/network-connections.js +17 -0
  312. package/dist/network-gateway-default.d.ts +1 -0
  313. package/dist/network-gateway-default.js +17 -0
  314. package/dist/network-interface-default.d.ts +1 -0
  315. package/dist/network-interface-default.js +17 -0
  316. package/dist/network-interfaces.d.ts +1 -0
  317. package/dist/network-interfaces.js +18 -0
  318. package/dist/network-stats.d.ts +1 -0
  319. package/dist/network-stats.js +19 -0
  320. package/dist/npm.d.ts +2 -0
  321. package/dist/npm.js +22 -0
  322. package/dist/npu.d.ts +1 -0
  323. package/dist/npu.js +17 -0
  324. package/dist/observe.d.ts +5 -0
  325. package/dist/observe.js +16 -0
  326. package/dist/os-info.d.ts +1 -0
  327. package/dist/os-info.js +21 -0
  328. package/dist/pci.d.ts +1 -0
  329. package/dist/pci.js +17 -0
  330. package/dist/printer.d.ts +1 -0
  331. package/dist/printer.js +17 -0
  332. package/dist/process-load.d.ts +1 -0
  333. package/dist/process-load.js +15 -0
  334. package/dist/processes.d.ts +1 -0
  335. package/dist/processes.js +15 -0
  336. package/dist/services.d.ts +1 -0
  337. package/dist/services.js +15 -0
  338. package/dist/shell.d.ts +1 -0
  339. package/dist/shell.js +16 -0
  340. package/dist/software.d.ts +1 -0
  341. package/dist/software.js +17 -0
  342. package/dist/sun/index.d.ts +17 -0
  343. package/dist/sun/index.js +43 -0
  344. package/dist/sun/inet-latency.d.ts +1 -0
  345. package/dist/sun/inet-latency.js +30 -0
  346. package/dist/sun/os-info.d.ts +1 -0
  347. package/dist/sun/os-info.js +26 -0
  348. package/dist/sun/users.d.ts +2 -0
  349. package/dist/sun/users.js +13 -0
  350. package/dist/system.d.ts +1 -0
  351. package/dist/system.js +17 -0
  352. package/dist/thunderbolt.d.ts +1 -0
  353. package/dist/thunderbolt.js +17 -0
  354. package/dist/time.d.ts +6 -0
  355. package/dist/time.js +28 -0
  356. package/dist/usb.d.ts +1 -0
  357. package/dist/usb.js +17 -0
  358. package/dist/users.d.ts +1 -0
  359. package/dist/users.js +21 -0
  360. package/dist/uuid.d.ts +1 -0
  361. package/dist/uuid.js +19 -0
  362. package/dist/version.d.ts +1 -0
  363. package/dist/version.js +16 -0
  364. package/dist/versions.d.ts +2 -0
  365. package/dist/versions.js +1122 -0
  366. package/dist/virtualbox.d.ts +2 -0
  367. package/dist/virtualbox.js +89 -0
  368. package/dist/wifi-connections.d.ts +1 -0
  369. package/dist/wifi-connections.js +17 -0
  370. package/dist/wifi-interfaces.d.ts +1 -0
  371. package/dist/wifi-interfaces.js +17 -0
  372. package/dist/wifi-networks.d.ts +1 -0
  373. package/dist/wifi-networks.js +17 -0
  374. package/dist/windows/audio.d.ts +2 -0
  375. package/dist/windows/audio.js +23 -0
  376. package/dist/windows/baseboard.d.ts +1 -0
  377. package/dist/windows/baseboard.js +35 -0
  378. package/dist/windows/battery.d.ts +1 -0
  379. package/dist/windows/battery.js +81 -0
  380. package/dist/windows/bios.d.ts +1 -0
  381. package/dist/windows/bios.js +37 -0
  382. package/dist/windows/block-devices.d.ts +2 -0
  383. package/dist/windows/block-devices.js +48 -0
  384. package/dist/windows/bluetooth.d.ts +2 -0
  385. package/dist/windows/bluetooth.js +31 -0
  386. package/dist/windows/camera.d.ts +2 -0
  387. package/dist/windows/camera.js +47 -0
  388. package/dist/windows/chassis.d.ts +1 -0
  389. package/dist/windows/chassis.js +29 -0
  390. package/dist/windows/cpu-cache.d.ts +2 -0
  391. package/dist/windows/cpu-cache.js +59 -0
  392. package/dist/windows/cpu-flags.d.ts +1 -0
  393. package/dist/windows/cpu-flags.js +61 -0
  394. package/dist/windows/cpu-temperature.d.ts +1 -0
  395. package/dist/windows/cpu-temperature.js +32 -0
  396. package/dist/windows/cpu.d.ts +1 -0
  397. package/dist/windows/cpu.js +96 -0
  398. package/dist/windows/disk-layout.d.ts +2 -0
  399. package/dist/windows/disk-layout.js +112 -0
  400. package/dist/windows/disks-io.d.ts +2 -0
  401. package/dist/windows/disks-io.js +43 -0
  402. package/dist/windows/displays.d.ts +2 -0
  403. package/dist/windows/displays.js +213 -0
  404. package/dist/windows/fs-open-files.d.ts +2 -0
  405. package/dist/windows/fs-open-files.js +22 -0
  406. package/dist/windows/fs-size.d.ts +2 -0
  407. package/dist/windows/fs-size.js +47 -0
  408. package/dist/windows/fs-stats.d.ts +2 -0
  409. package/dist/windows/fs-stats.js +37 -0
  410. package/dist/windows/gpu.d.ts +2 -0
  411. package/dist/windows/gpu.js +128 -0
  412. package/dist/windows/index.d.ts +56 -0
  413. package/dist/windows/index.js +122 -0
  414. package/dist/windows/inet-latency.d.ts +1 -0
  415. package/dist/windows/inet-latency.js +34 -0
  416. package/dist/windows/keyboard.d.ts +2 -0
  417. package/dist/windows/keyboard.js +47 -0
  418. package/dist/windows/mem-layout.d.ts +2 -0
  419. package/dist/windows/mem-layout.js +39 -0
  420. package/dist/windows/mem.d.ts +2 -0
  421. package/dist/windows/mem.js +33 -0
  422. package/dist/windows/mouse.d.ts +2 -0
  423. package/dist/windows/mouse.js +64 -0
  424. package/dist/windows/network-connections.d.ts +2 -0
  425. package/dist/windows/network-connections.js +93 -0
  426. package/dist/windows/network-gateway-default.d.ts +1 -0
  427. package/dist/windows/network-gateway-default.js +36 -0
  428. package/dist/windows/network-interface-default.d.ts +2 -0
  429. package/dist/windows/network-interface-default.js +56 -0
  430. package/dist/windows/network-interfaces.d.ts +2 -0
  431. package/dist/windows/network-interfaces.js +346 -0
  432. package/dist/windows/network-stats.d.ts +2 -0
  433. package/dist/windows/network-stats.js +135 -0
  434. package/dist/windows/npm.d.ts +1 -0
  435. package/dist/windows/npm.js +5 -0
  436. package/dist/windows/npu.d.ts +2 -0
  437. package/dist/windows/npu.js +29 -0
  438. package/dist/windows/os-info.d.ts +1 -0
  439. package/dist/windows/os-info.js +65 -0
  440. package/dist/windows/pci.d.ts +2 -0
  441. package/dist/windows/pci.js +33 -0
  442. package/dist/windows/printer.d.ts +2 -0
  443. package/dist/windows/printer.js +36 -0
  444. package/dist/windows/process-load.d.ts +2 -0
  445. package/dist/windows/process-load.js +121 -0
  446. package/dist/windows/processes.d.ts +9 -0
  447. package/dist/windows/processes.js +139 -0
  448. package/dist/windows/services.d.ts +2 -0
  449. package/dist/windows/services.js +83 -0
  450. package/dist/windows/shell.d.ts +1 -0
  451. package/dist/windows/shell.js +19 -0
  452. package/dist/windows/software.d.ts +2 -0
  453. package/dist/windows/software.js +53 -0
  454. package/dist/windows/system.d.ts +1 -0
  455. package/dist/windows/system.js +98 -0
  456. package/dist/windows/thunderbolt.d.ts +2 -0
  457. package/dist/windows/thunderbolt.js +34 -0
  458. package/dist/windows/usb.d.ts +2 -0
  459. package/dist/windows/usb.js +37 -0
  460. package/dist/windows/users.d.ts +2 -0
  461. package/dist/windows/users.js +151 -0
  462. package/dist/windows/uuid.d.ts +2 -0
  463. package/dist/windows/uuid.js +28 -0
  464. package/dist/windows/wifi-connections.d.ts +2 -0
  465. package/dist/windows/wifi-connections.js +56 -0
  466. package/dist/windows/wifi-interfaces.d.ts +2 -0
  467. package/dist/windows/wifi-interfaces.js +45 -0
  468. package/dist/windows/wifi-networks.d.ts +2 -0
  469. package/dist/windows/wifi-networks.js +50 -0
  470. package/package.json +78 -12
  471. package/lib/audio.js +0 -277
  472. package/lib/battery.js +0 -334
  473. package/lib/bluetooth.js +0 -315
  474. package/lib/bluetoothVendors.js +0 -1138
  475. package/lib/cli.js +0 -100
  476. package/lib/cpu.js +0 -2285
  477. package/lib/docker.js +0 -791
  478. package/lib/dockerSocket.js +0 -117
  479. package/lib/filesystem.js +0 -1832
  480. package/lib/graphics.js +0 -1321
  481. package/lib/index.d.ts +0 -1051
  482. package/lib/index.js +0 -520
  483. package/lib/internet.js +0 -259
  484. package/lib/memory.js +0 -622
  485. package/lib/network.js +0 -2008
  486. package/lib/osinfo.js +0 -1321
  487. package/lib/printer.js +0 -209
  488. package/lib/processes.js +0 -1459
  489. package/lib/system.js +0 -855
  490. package/lib/usb.js +0 -309
  491. package/lib/users.js +0 -412
  492. package/lib/util.js +0 -2824
  493. package/lib/virtualbox.js +0 -116
  494. package/lib/wifi.js +0 -839
package/lib/cpu.js DELETED
@@ -1,2285 +0,0 @@
1
- 'use strict';
2
- // @ts-check
3
- // ==================================================================================
4
- // cpu.js
5
- // ----------------------------------------------------------------------------------
6
- // Description: System Information - library
7
- // for Node.js
8
- // Copyright: (c) 2014 - 2026
9
- // Author: Sebastian Hildebrandt
10
- // ----------------------------------------------------------------------------------
11
- // License: MIT
12
- // ==================================================================================
13
- // 4. CPU
14
- // ----------------------------------------------------------------------------------
15
-
16
- const os = require('os');
17
- const exec = require('child_process').exec;
18
- const execSync = require('child_process').execSync;
19
- const fs = require('fs');
20
- const util = require('./util');
21
-
22
- const _platform = process.platform;
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';
31
-
32
- let _cpu_speed = 0;
33
- let _current_cpu = {
34
- user: 0,
35
- nice: 0,
36
- system: 0,
37
- idle: 0,
38
- irq: 0,
39
- steal: 0,
40
- guest: 0,
41
- load: 0,
42
- tick: 0,
43
- ms: 0,
44
- currentLoad: 0,
45
- currentLoadUser: 0,
46
- currentLoadSystem: 0,
47
- currentLoadNice: 0,
48
- currentLoadIdle: 0,
49
- currentLoadIrq: 0,
50
- currentLoadSteal: 0,
51
- currentLoadGuest: 0,
52
- rawCurrentLoad: 0,
53
- rawCurrentLoadUser: 0,
54
- rawCurrentLoadSystem: 0,
55
- rawCurrentLoadNice: 0,
56
- rawCurrentLoadIdle: 0,
57
- rawCurrentLoadIrq: 0,
58
- rawCurrentLoadSteal: 0,
59
- rawCurrentLoadGuest: 0
60
- };
61
- let _cpus = [];
62
- let _corecount = 0;
63
-
64
- const AMDBaseFrequencies = {
65
- 8346: '1.8',
66
- 8347: '1.9',
67
- 8350: '2.0',
68
- 8354: '2.2',
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',
99
- '2419EE': '1.8',
100
- '2423HE': '2.0',
101
- '2425HE': '2.1',
102
- 2427: '2.2',
103
- 2431: '2.4',
104
- 2435: '2.6',
105
- '2439SE': '2.8',
106
- '8425HE': '2.1',
107
- 8431: '2.4',
108
- 8435: '2.6',
109
- '8439SE': '2.8',
110
- 4122: '2.2',
111
- 4130: '2.6',
112
- '4162EE': '1.7',
113
- '4164EE': '1.8',
114
- '4170HE': '2.1',
115
- '4174HE': '2.3',
116
- '4176HE': '2.4',
117
- 4180: '2.6',
118
- 4184: '2.8',
119
- '6124HE': '1.8',
120
- '6128HE': '2.0',
121
- '6132HE': '2.2',
122
- 6128: '2.0',
123
- 6134: '2.3',
124
- 6136: '2.4',
125
- 6140: '2.6',
126
- '6164HE': '1.7',
127
- '6166HE': '1.8',
128
- 6168: '1.9',
129
- 6172: '2.1',
130
- 6174: '2.2',
131
- 6176: '2.3',
132
- '6176SE': '2.3',
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',
153
- '6262HE': '1.6',
154
- 6272: '2.1',
155
- 6274: '2.2',
156
- 6276: '2.3',
157
- 6278: '2.4',
158
- '6282SE': '2.6',
159
- '6284SE': '2.7',
160
- 6308: '3.5',
161
- 6320: '2.8',
162
- 6328: '3.2',
163
- '6338P': '2.3',
164
- 6344: '2.6',
165
- 6348: '2.8',
166
- 6366: '1.8',
167
- '6370P': '2.0',
168
- 6376: '2.3',
169
- 6378: '2.4',
170
- 6380: '2.5',
171
- 6386: '2.8',
172
- 'FX|4100': '3.6',
173
- 'FX|4120': '3.9',
174
- 'FX|4130': '3.8',
175
- 'FX|4150': '3.8',
176
- 'FX|4170': '4.2',
177
- 'FX|6100': '3.3',
178
- 'FX|6120': '3.6',
179
- 'FX|6130': '3.6',
180
- 'FX|6200': '3.8',
181
- 'FX|8100': '2.8',
182
- 'FX|8120': '3.1',
183
- 'FX|8140': '3.2',
184
- 'FX|8150': '3.6',
185
- 'FX|8170': '3.9',
186
- 'FX|4300': '3.8',
187
- 'FX|4320': '4.0',
188
- 'FX|4350': '4.2',
189
- 'FX|6300': '3.5',
190
- 'FX|6350': '3.9',
191
- 'FX|8300': '3.3',
192
- 'FX|8310': '3.4',
193
- 'FX|8320': '3.5',
194
- 'FX|8350': '4.0',
195
- 'FX|8370': '4.0',
196
- 'FX|9370': '4.4',
197
- 'FX|9590': '4.7',
198
- 'FX|8320E': '3.2',
199
- 'FX|8370E': '3.3',
200
-
201
- // ZEN Desktop CPUs
202
- 1200: '3.1',
203
- 'Pro 1200': '3.1',
204
- '1300X': '3.5',
205
- 'Pro 1300': '3.5',
206
- 1400: '3.2',
207
- '1500X': '3.5',
208
- 'Pro 1500': '3.5',
209
- 1600: '3.2',
210
- '1600X': '3.6',
211
- 'Pro 1600': '3.2',
212
- 1700: '3.0',
213
- 'Pro 1700': '3.0',
214
- '1700X': '3.4',
215
- 'Pro 1700X': '3.4',
216
- '1800X': '3.6',
217
- '1900X': '3.8',
218
- 1920: '3.2',
219
- '1920X': '3.5',
220
- '1950X': '3.4',
221
-
222
- // ZEN Desktop APUs
223
- '200GE': '3.2',
224
- 'Pro 200GE': '3.2',
225
- '220GE': '3.4',
226
- '240GE': '3.5',
227
- '3000G': '3.5',
228
- '300GE': '3.4',
229
- '3050GE': '3.4',
230
- '2200G': '3.5',
231
- 'Pro 2200G': '3.5',
232
- '2200GE': '3.2',
233
- 'Pro 2200GE': '3.2',
234
- '2400G': '3.6',
235
- 'Pro 2400G': '3.6',
236
- '2400GE': '3.2',
237
- 'Pro 2400GE': '3.2',
238
-
239
- // ZEN Mobile APUs
240
- 'Pro 200U': '2.3',
241
- '300U': '2.4',
242
- '2200U': '2.5',
243
- '3200U': '2.6',
244
- '2300U': '2.0',
245
- 'Pro 2300U': '2.0',
246
- '2500U': '2.0',
247
- 'Pro 2500U': '2.2',
248
- '2600H': '3.2',
249
- '2700U': '2.0',
250
- 'Pro 2700U': '2.2',
251
- '2800H': '3.3',
252
-
253
- // ZEN Server Processors
254
- 7351: '2.4',
255
- '7351P': '2.4',
256
- 7401: '2.0',
257
- '7401P': '2.0',
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',
269
-
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',
288
-
289
- // ZEN+ Desktop
290
- '1200|AF': '3.1',
291
- '2300X': '3.5',
292
- '2500X': '3.6',
293
- 2600: '3.4',
294
- '2600E': '3.1',
295
- '1600|AF': '3.2',
296
- '2600X': '3.6',
297
- 2700: '3.2',
298
- '2700E': '2.8',
299
- 'Pro 2700': '3.2',
300
- '2700X': '3.7',
301
- 'Pro 2700X': '3.6',
302
- '2920X': '3.5',
303
- '2950X': '3.5',
304
- '2970WX': '3.0',
305
- '2990WX': '3.0',
306
-
307
- // ZEN+ Desktop APU
308
- 'Pro 300GE': '3.4',
309
- 'Pro 3125GE': '3.4',
310
- '3150G': '3.5',
311
- 'Pro 3150G': '3.5',
312
- '3150GE': '3.3',
313
- 'Pro 3150GE': '3.3',
314
- '3200G': '3.6',
315
- 'Pro 3200G': '3.6',
316
- '3200GE': '3.3',
317
- 'Pro 3200GE': '3.3',
318
- '3350G': '3.6',
319
- 'Pro 3350G': '3.6',
320
- '3350GE': '3.3',
321
- 'Pro 3350GE': '3.3',
322
- '3400G': '3.7',
323
- 'Pro 3400G': '3.7',
324
- '3400GE': '3.3',
325
- 'Pro 3400GE': '3.3',
326
-
327
- // ZEN+ Mobile
328
- '3300U': '2.1',
329
- 'PRO 3300U': '2.1',
330
- '3450U': '2.1',
331
- '3500U': '2.1',
332
- 'PRO 3500U': '2.1',
333
- '3500C': '2.1',
334
- '3550H': '2.1',
335
- '3580U': '2.1',
336
- '3700U': '2.3',
337
- 'PRO 3700U': '2.3',
338
- '3700C': '2.3',
339
- '3750H': '2.3',
340
- '3780U': '2.3',
341
-
342
- // ZEN2 Desktop CPUS
343
- 3100: '3.6',
344
- '3300X': '3.8',
345
- 3500: '3.6',
346
- '3500X': '3.6',
347
- 3600: '3.6',
348
- 'Pro 3600': '3.6',
349
- '3600X': '3.8',
350
- '3600XT': '3.8',
351
- 'Pro 3700': '3.6',
352
- '3700X': '3.6',
353
- '3800X': '3.9',
354
- '3800XT': '3.9',
355
- 3900: '3.1',
356
- 'Pro 3900': '3.1',
357
- '3900X': '3.8',
358
- '3900XT': '3.8',
359
- '3950X': '3.5',
360
- '3960X': '3.8',
361
- '3970X': '3.7',
362
- '3990X': '2.9',
363
- '3945WX': '4.0',
364
- '3955WX': '3.9',
365
- '3975WX': '3.5',
366
- '3995WX': '2.7',
367
-
368
- // ZEN2 Desktop APUs
369
- '4300GE': '3.5',
370
- 'Pro 4300GE': '3.5',
371
- '4300G': '3.8',
372
- 'Pro 4300G': '3.8',
373
- '4600GE': '3.3',
374
- 'Pro 4650GE': '3.3',
375
- '4600G': '3.7',
376
- 'Pro 4650G': '3.7',
377
- '4700GE': '3.1',
378
- 'Pro 4750GE': '3.1',
379
- '4700G': '3.6',
380
- 'Pro 4750G': '3.6',
381
- '4300U': '2.7',
382
- '4450U': '2.5',
383
- 'Pro 4450U': '2.5',
384
- '4500U': '2.3',
385
- '4600U': '2.1',
386
- 'PRO 4650U': '2.1',
387
- '4680U': '2.1',
388
- '4600HS': '3.0',
389
- '4600H': '3.0',
390
- '4700U': '2.0',
391
- 'PRO 4750U': '1.7',
392
- '4800U': '1.8',
393
- '4800HS': '2.9',
394
- '4800H': '2.9',
395
- '4900HS': '3.0',
396
- '4900H': '3.3',
397
- '5300U': '2.6',
398
- '5500U': '2.1',
399
- '5700U': '1.8',
400
-
401
- // ZEN2 - EPYC
402
- '7232P': '3.1',
403
- '7302P': '3.0',
404
- '7402P': '2.8',
405
- '7502P': '2.5',
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',
423
- '7H12': '2.6',
424
- '7F32': '3.7',
425
- '7F52': '3.5',
426
- '7F72': '3.2',
427
-
428
- // Epyc (Milan)
429
-
430
- '7773X': '2.2',
431
- 7763: '2.45',
432
- 7713: '2.0',
433
- '7713P': '2.0',
434
- 7663: '2.0',
435
- 7643: '2.3',
436
- '7573X': '2.8',
437
- '75F3': '2.95',
438
- 7543: '2.8',
439
- '7543P': '2.8',
440
- 7513: '2.6',
441
- '7473X': '2.8',
442
- 7453: '2.75',
443
- '74F3': '3.2',
444
- 7443: '2.85',
445
- '7443P': '2.85',
446
- 7413: '2.65',
447
- '7373X': '3.05',
448
- '73F3': '3.5',
449
- 7343: '3.2',
450
- 7313: '3.0',
451
- '7313P': '3.0',
452
- '72F3': '3.7',
453
-
454
- // ZEN3
455
- '5600X': '3.7',
456
- '5800X': '3.8',
457
- '5900X': '3.7',
458
- '5950X': '3.4',
459
- '5945WX': '4.1',
460
- '5955WX': '4.0',
461
- '5965WX': '3.8',
462
- '5975WX': '3.6',
463
- '5995WX': '2.7',
464
-
465
- '7960X': '4.2',
466
- '7970X': '4.0',
467
- '7980X': '3.2',
468
-
469
- '7965WX': '4.2',
470
- '7975WX': '4.0',
471
- '7985WX': '3.2',
472
- '7995WX': '2.5',
473
-
474
- // ZEN4
475
- 9754: '2.25',
476
- '9754S': '2.25',
477
- 9734: '2.2',
478
- '9684X': '2.55',
479
- '9384X': '3.1',
480
- '9184X': '3.55',
481
- '9654P': '2.4',
482
- 9654: '2.4',
483
- 9634: '2.25',
484
- '9554P': '3.1',
485
- 9554: '3.1',
486
- 9534: '2.45',
487
- '9474F': '3.6',
488
- '9454P': '2.75',
489
- 9454: '2.75',
490
- '9374F': '3.85',
491
- '9354P': '3.25',
492
- 9354: '3.25',
493
- 9334: '2.7',
494
- '9274F': '4.05',
495
- 9254: '2.9',
496
- 9224: '2.5',
497
- '9174F': '4.1',
498
- 9124: '3.0',
499
-
500
- // Epyc 4th gen
501
- '4124P': '3.8',
502
- '4244P': '3.8',
503
- '4344P': '3.8',
504
- '4364P': '4.5',
505
- '4464P': '3.7',
506
- '4484PX': '4.4',
507
- '4564P': '4.5',
508
- '4584PX': '4.2',
509
- '8024P': '2.4',
510
- '8024PN': '2.05',
511
- '8124P': '2.45',
512
- '8124PN': '2.0',
513
- '8224P': '2.55',
514
- '8224PN': '2.0',
515
- '8324P': '2.65',
516
- '8324PN': '2.05',
517
- '8434P': '2.5',
518
- '8434PN': '2.0',
519
- '8534P': '2.3',
520
- '8534PN': '2.0',
521
-
522
- // Epyc 5th gen
523
- 9115: '2.6',
524
- 9135: '3.65',
525
- '9175F': '4.2',
526
- 9255: '3.25',
527
- '9275F': '4.1',
528
- 9335: '3.0',
529
- '9355P': '3.55',
530
- 9355: '3.55',
531
- '9375F': '3.8',
532
- 9365: '3.4',
533
- '9455P': '3.15',
534
- 9455: '3.15',
535
- '9475F': '3.65',
536
- 9535: '2.4',
537
- '9555P': '3.2',
538
- 9555: '3.2',
539
- '9575F': '3.3',
540
- 9565: '3.15',
541
- '9655P': '2.5',
542
- 9655: '2.5',
543
- 9755: '2.7',
544
- '4245P': '3.9',
545
- '4345P': '3.8',
546
- '4465P': '3.4',
547
- '4545P': '3.0',
548
- '4565P': '4.3',
549
- '4585PX': '4.3',
550
- '5900XT': '3.3',
551
- 5900: '3.0',
552
- 5945: '3.0',
553
- '5800X3D': '3.4',
554
- '5800XT': '3.8',
555
- 5800: '3.4',
556
- '5700X3D': '3.0',
557
- '5700X': '3.4',
558
- 5845: '3.4',
559
- '5600X3D': '3.3',
560
- '5600XT': '3.7',
561
- '5600T': '3.5',
562
- 5600: '3.5',
563
- '5600F': '3.0',
564
- 5645: '3.7',
565
- '5500X3D': '3.0',
566
- '5980HX': '3.3',
567
- '5980HS': '3.0',
568
- '5900HX': '3.3',
569
- '5900HS': '3.0',
570
- '5800H': '3.2',
571
- '5800HS': '2.8',
572
- '5800U': '1.9',
573
- '5600H': '3.3',
574
- '5600HS': '3.0',
575
- '5600U': '2.3',
576
- '5560U': '2.3',
577
- '5400U': '2.7',
578
- '5825U': '2.0',
579
- '5625U': '2.3',
580
- '5425U': '2.7',
581
- '5125C': '3.0',
582
- '7730U': '2.0',
583
- '7530U': '2.0',
584
- '7430U': '2.3',
585
- '7330U': '2.3',
586
- 7203: '2.8',
587
- 7303: '2.4',
588
- '7663P': '2.0',
589
- '6980HX': '3.3',
590
- '6980HS': '3.3',
591
- '6900HX': '3.3',
592
- '6900HS': '3.3',
593
- '6800H': '3.2',
594
- '6800HS': '3.2',
595
- '6800U': '2.7',
596
- '6600H': '3.3',
597
- '6600HS': '3.3',
598
- '6600U': '2.9',
599
- '7735HS': '3.2',
600
- '7735H': '3.2',
601
- '7736U': '2.7',
602
- '7735U': '2.7',
603
- '7435HS': '3.1',
604
- '7435H': '3.1',
605
- '7535HS': '3.3',
606
- '7535H': '3.3',
607
- '7535U': '2.9',
608
- '7235HS': '3.2',
609
- '7235H': '3.2',
610
- '7335U': '3.0',
611
- 270: '4.0',
612
- 260: '3.8',
613
- 250: '3.3',
614
- 240: '4.3',
615
- 230: '3.5',
616
- 220: '3.0',
617
- 210: '2.8',
618
- '8945HS': '4.0',
619
- '8845HS': '3.8',
620
- '8840HS': '3.3',
621
- '8840U': '3.3',
622
- '8645HS': '4.3',
623
- '8640HS': '3.5',
624
- '8640U': '3.5',
625
- '8540U': '3.0',
626
- '8440U': '2.8',
627
- '9950X3D': '4.3',
628
- '9950X': '4.3',
629
- '9900X3D': '4.4',
630
- '9900X': '4.4',
631
- '9800X3D': '4.7',
632
- '9700X': '3.8',
633
- '9700F': '3.8',
634
- '9600X': '3.9',
635
- 9600: '3.8',
636
- '9500F': '3.8',
637
- '9995WX': '2.5',
638
- '9985WX': '3.2',
639
- '9975WX': '4.0',
640
- '9965WX': '4.2',
641
- '9955WX': '4.5',
642
- '9945WX': '4.7',
643
- '9980X': '3.2',
644
- '9970X': '4.0',
645
- '9960X': '4.2',
646
- 'PRO HX375': '2.0',
647
- HX375: '2.0',
648
- 'PRO HX370': '2.0',
649
- HX370: '2.0',
650
- 365: '2.0',
651
- 'PRO 360': '2.0',
652
- 350: '2.0',
653
- 'PRO 350': '2.0',
654
- 340: '2.0',
655
- 'PRO 340': '2.0',
656
- 330: '2.0',
657
- 395: '3.0',
658
- 'PRO 395': '3.0',
659
- 390: '3.2',
660
- 'PRO 390': '3.2',
661
- 385: '3.6',
662
- 'PRO 385': '3.6',
663
- 'PRO 380': '3.6',
664
- '9955HX3D': '2.3',
665
- '9955HX': '2.5',
666
- '9850HX': '3.0',
667
- 9015: '3.6',
668
- 9965: '2.25',
669
- 9845: '2.1',
670
- 9825: '2.2',
671
- 9745: '2.4',
672
- 9645: '2.3'
673
- };
674
-
675
- const socketTypes = {
676
- 1: 'Other',
677
- 2: 'Unknown',
678
- 3: 'Daughter Board',
679
- 4: 'ZIF Socket',
680
- 5: 'Replacement/Piggy Back',
681
- 6: 'None',
682
- 7: 'LIF Socket',
683
- 8: 'Slot 1',
684
- 9: 'Slot 2',
685
- 10: '370 Pin Socket',
686
- 11: 'Slot A',
687
- 12: 'Slot M',
688
- 13: '423',
689
- 14: 'A (Socket 462)',
690
- 15: '478',
691
- 16: '754',
692
- 17: '940',
693
- 18: '939',
694
- 19: 'mPGA604',
695
- 20: 'LGA771',
696
- 21: 'LGA775',
697
- 22: 'S1',
698
- 23: 'AM2',
699
- 24: 'F (1207)',
700
- 25: 'LGA1366',
701
- 26: 'G34',
702
- 27: 'AM3',
703
- 28: 'C32',
704
- 29: 'LGA1156',
705
- 30: 'LGA1567',
706
- 31: 'PGA988A',
707
- 32: 'BGA1288',
708
- 33: 'rPGA988B',
709
- 34: 'BGA1023',
710
- 35: 'BGA1224',
711
- 36: 'LGA1155',
712
- 37: 'LGA1356',
713
- 38: 'LGA2011',
714
- 39: 'FS1',
715
- 40: 'FS2',
716
- 41: 'FM1',
717
- 42: 'FM2',
718
- 43: 'LGA2011-3',
719
- 44: 'LGA1356-3',
720
- 45: 'LGA1150',
721
- 46: 'BGA1168',
722
- 47: 'BGA1234',
723
- 48: 'BGA1364',
724
- 49: 'AM4',
725
- 50: 'LGA1151',
726
- 51: 'BGA1356',
727
- 52: 'BGA1440',
728
- 53: 'BGA1515',
729
- 54: 'LGA3647-1',
730
- 55: 'SP3',
731
- 56: 'SP3r2',
732
- 57: 'LGA2066',
733
- 58: 'BGA1392',
734
- 59: 'BGA1510',
735
- 60: 'BGA1528',
736
- 61: 'LGA4189',
737
- 62: 'LGA1200',
738
- 63: 'LGA4677',
739
- 64: 'LGA1700',
740
- 65: 'BGA1744',
741
- 66: 'BGA1781',
742
- 67: 'BGA1211',
743
- 68: 'BGA2422',
744
- 69: 'LGA1211',
745
- 70: 'LGA2422',
746
- 71: 'LGA5773',
747
- 72: 'BGA5773',
748
- 73: 'AM5',
749
- 74: 'SP5',
750
- 75: 'SP6',
751
- 76: 'BGA883',
752
- 77: 'BGA1190',
753
- 78: 'BGA4129',
754
- 79: 'LGA4710',
755
- 80: 'LGA7529',
756
- 81: 'BGA1964',
757
- 82: 'BGA1792',
758
- 83: 'BGA2049',
759
- 84: 'BGA2551',
760
- 85: 'LGA1851',
761
- 86: 'BGA2114',
762
- 87: 'BGA2833'
763
- };
764
-
765
- const socketTypesByName = {
766
- LGA1150:
767
- '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',
768
- LGA1151:
769
- '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',
770
- 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'
771
- };
772
-
773
- function getSocketTypesByName(str) {
774
- let result = '';
775
- for (const key in socketTypesByName) {
776
- const names = socketTypesByName[key].split(' ');
777
- names.forEach((element) => {
778
- if (str.indexOf(element) >= 0) {
779
- result = key;
780
- }
781
- });
782
- }
783
- return result;
784
- }
785
-
786
- function cpuManufacturer(str) {
787
- let result = str;
788
- str = str.toLowerCase();
789
-
790
- if (str.indexOf('intel') >= 0) {
791
- result = 'Intel';
792
- }
793
- if (str.indexOf('amd') >= 0) {
794
- result = 'AMD';
795
- }
796
- if (str.indexOf('qemu') >= 0) {
797
- result = 'QEMU';
798
- }
799
- if (str.indexOf('hygon') >= 0) {
800
- result = 'Hygon';
801
- }
802
- if (str.indexOf('centaur') >= 0) {
803
- result = 'WinChip/Via';
804
- }
805
- if (str.indexOf('vmware') >= 0) {
806
- result = 'VMware';
807
- }
808
- if (str.indexOf('Xen') >= 0) {
809
- result = 'Xen Hypervisor';
810
- }
811
- if (str.indexOf('tcg') >= 0) {
812
- result = 'QEMU';
813
- }
814
- if (str.indexOf('apple') >= 0) {
815
- result = 'Apple';
816
- }
817
- if (str.indexOf('sifive') >= 0) {
818
- result = 'SiFive';
819
- }
820
- if (str.indexOf('thead') >= 0) {
821
- result = 'T-Head';
822
- }
823
- if (str.indexOf('andestech') >= 0) {
824
- result = 'Andes Technology';
825
- }
826
-
827
- return result;
828
- }
829
-
830
- function cpuBrandManufacturer(res) {
831
- res.brand = res.brand
832
- .replace(/\(R\)+/g, '®')
833
- .replace(/\s+/g, ' ')
834
- .trim();
835
- res.brand = res.brand
836
- .replace(/\(TM\)+/g, '™')
837
- .replace(/\s+/g, ' ')
838
- .trim();
839
- res.brand = res.brand
840
- .replace(/\(C\)+/g, '©')
841
- .replace(/\s+/g, ' ')
842
- .trim();
843
- res.brand = res.brand.replace(/CPU+/g, '').replace(/\s+/g, ' ').trim();
844
- res.manufacturer = cpuManufacturer(res.brand);
845
-
846
- let parts = res.brand.split(' ');
847
- parts.shift();
848
- res.brand = parts.join(' ');
849
- return res;
850
- }
851
-
852
- function getAMDSpeed(brand) {
853
- let result = '0';
854
- for (let key in AMDBaseFrequencies) {
855
- if ({}.hasOwnProperty.call(AMDBaseFrequencies, key)) {
856
- let parts = key.split('|');
857
- let found = 0;
858
- parts.forEach((item) => {
859
- if (brand.indexOf(item) > -1) {
860
- found++;
861
- }
862
- });
863
- if (found === parts.length) {
864
- result = AMDBaseFrequencies[key];
865
- }
866
- }
867
- }
868
- return parseFloat(result);
869
- }
870
-
871
- // --------------------------
872
- // CPU - brand, speed
873
-
874
- function getCpu() {
875
- return new Promise((resolve) => {
876
- process.nextTick(() => {
877
- const UNKNOWN = 'unknown';
878
- let result = {
879
- manufacturer: UNKNOWN,
880
- brand: UNKNOWN,
881
- vendor: '',
882
- family: '',
883
- model: '',
884
- stepping: '',
885
- revision: '',
886
- voltage: '',
887
- speed: 0,
888
- speedMin: 0,
889
- speedMax: 0,
890
- governor: '',
891
- cores: util.cores(),
892
- physicalCores: util.cores(),
893
- performanceCores: util.cores(),
894
- efficiencyCores: 0,
895
- processors: 1,
896
- socket: '',
897
- flags: '',
898
- virtualization: false,
899
- cache: {}
900
- };
901
- cpuFlags().then((flags) => {
902
- result.flags = flags;
903
- result.virtualization = flags.indexOf('vmx') > -1 || flags.indexOf('svm') > -1;
904
- if (_darwin) {
905
- exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily', (error, stdout) => {
906
- const lines = stdout.toString().split('\n');
907
- const modelline = util.getValue(lines, 'machdep.cpu.brand_string');
908
- const modellineParts = modelline.split('@');
909
- result.brand = modellineParts[0].trim();
910
- const speed = modellineParts[1] ? modellineParts[1].trim() : '0';
911
- result.speed = parseFloat(speed.replace(/GHz+/g, ''));
912
- let tbFrequency = util.getValue(lines, 'hw.tbfrequency') / 1000000000.0;
913
- tbFrequency = tbFrequency < 0.1 ? tbFrequency * 100 : tbFrequency;
914
- result.speed = result.speed === 0 ? tbFrequency : result.speed;
915
-
916
- _cpu_speed = result.speed;
917
- result = cpuBrandManufacturer(result);
918
- result.speedMin = util.getValue(lines, 'hw.cpufrequency_min') ? util.getValue(lines, 'hw.cpufrequency_min') / 1000000000.0 : result.speed;
919
- result.speedMax = util.getValue(lines, 'hw.cpufrequency_max') ? util.getValue(lines, 'hw.cpufrequency_max') / 1000000000.0 : result.speed;
920
- result.vendor = util.getValue(lines, 'machdep.cpu.vendor') || 'Apple';
921
- result.family = util.getValue(lines, 'machdep.cpu.family') || util.getValue(lines, 'hw.cpufamily');
922
- result.model = util.getValue(lines, 'machdep.cpu.model');
923
- result.stepping = util.getValue(lines, 'machdep.cpu.stepping') || util.getValue(lines, 'hw.cpusubfamily');
924
- result.virtualization = true;
925
- const countProcessors = util.getValue(lines, 'hw.packages');
926
- const countCores = util.getValue(lines, 'hw.physicalcpu_max');
927
- const countThreads = util.getValue(lines, 'hw.ncpu');
928
- if (os.arch() === 'arm64') {
929
- result.socket = 'SOC';
930
- try {
931
- const clusters = execSync('ioreg -c IOPlatformDevice -d 3 -r | grep cluster-type').toString().split('\n');
932
- const efficiencyCores = clusters.filter((line) => line.indexOf('"E"') >= 0).length + clusters.filter((line) => line.indexOf('"M"') >= 0).length;
933
- const performanceCores = clusters.filter((line) => line.indexOf('"P"') >= 0).length;
934
- result.efficiencyCores = efficiencyCores;
935
- result.performanceCores = performanceCores;
936
- } catch {
937
- util.noop();
938
- }
939
- }
940
- if (countProcessors) {
941
- result.processors = parseInt(countProcessors, 10) || 1;
942
- }
943
- if (countCores && countThreads) {
944
- result.cores = parseInt(countThreads) || util.cores();
945
- result.physicalCores = parseInt(countCores) || util.cores();
946
- }
947
- cpuCache().then((res) => {
948
- result.cache = res;
949
- resolve(result);
950
- });
951
- });
952
- }
953
- if (_linux) {
954
- let modelline = '';
955
- let lines = [];
956
- if (os.cpus()[0] && os.cpus()[0].model) {
957
- modelline = os.cpus()[0].model;
958
- }
959
- 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', (error, stdout) => {
960
- if (!error) {
961
- lines = stdout.toString().split('\n');
962
- }
963
- modelline = util.getValue(lines, 'model name') || modelline;
964
- modelline = util.getValue(lines, 'bios model name') || modelline;
965
- modelline = util.cleanString(modelline);
966
- const modellineParts = modelline.split('@');
967
- result.brand = modellineParts[0].trim();
968
- if (result.brand.indexOf('Unknown') >= 0) {
969
- result.brand = result.brand.split('Unknown')[0].trim();
970
- }
971
- result.speed = modellineParts[1] ? parseFloat(modellineParts[1].trim()) : 0;
972
- if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
973
- result.speed = getAMDSpeed(result.brand);
974
- }
975
- if (result.speed === 0) {
976
- const current = getCpuCurrentSpeedSync();
977
- if (current.avg !== 0) {
978
- result.speed = current.avg;
979
- }
980
- }
981
- _cpu_speed = result.speed;
982
- result.speedMin = Math.round(parseFloat(util.getValue(lines, 'cpu min mhz').replace(/,/g, '.')) / 10.0) / 100 || result.speedMin;
983
- result.speedMax = Math.round(parseFloat(util.getValue(lines, 'cpu max mhz').replace(/,/g, '.')) / 10.0) / 100 || result.speedMax;
984
-
985
- result = cpuBrandManufacturer(result);
986
- result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id'));
987
-
988
- result.family = util.getValue(lines, 'cpu family');
989
- result.model = util.getValue(lines, 'model:');
990
- result.stepping = util.getValue(lines, 'stepping');
991
- result.revision = util.getValue(lines, 'cpu revision');
992
- result.cache.l1d = util.getValue(lines, 'l1d cache');
993
- if (result.cache.l1d) {
994
- result.cache.l1d = parseInt(result.cache.l1d) * (result.cache.l1d.indexOf('M') !== -1 ? 1024 * 1024 : result.cache.l1d.indexOf('K') !== -1 ? 1024 : 1);
995
- }
996
- result.cache.l1i = util.getValue(lines, 'l1i cache');
997
- if (result.cache.l1i) {
998
- result.cache.l1i = parseInt(result.cache.l1i) * (result.cache.l1i.indexOf('M') !== -1 ? 1024 * 1024 : result.cache.l1i.indexOf('K') !== -1 ? 1024 : 1);
999
- }
1000
- result.cache.l2 = util.getValue(lines, 'l2 cache');
1001
- if (result.cache.l2) {
1002
- result.cache.l2 = parseInt(result.cache.l2) * (result.cache.l2.indexOf('M') !== -1 ? 1024 * 1024 : result.cache.l2.indexOf('K') !== -1 ? 1024 : 1);
1003
- }
1004
- result.cache.l3 = util.getValue(lines, 'l3 cache');
1005
- if (result.cache.l3) {
1006
- result.cache.l3 = parseInt(result.cache.l3) * (result.cache.l3.indexOf('M') !== -1 ? 1024 * 1024 : result.cache.l3.indexOf('K') !== -1 ? 1024 : 1);
1007
- }
1008
-
1009
- const threadsPerCore = util.getValue(lines, 'thread(s) per core') || '1';
1010
- const processors = util.getValue(lines, 'socket(s)') || '1';
1011
- const threadsPerCoreInt = parseInt(threadsPerCore, 10); // threads per code (normally only for performance cores)
1012
- const processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1)
1013
- const coresPerSocket = parseInt(util.getValue(lines, 'core(s) per socket'), 10); // number of cores (e.g. 16 on i12900)
1014
- result.physicalCores = coresPerSocket ? coresPerSocket * processorsInt : result.cores / threadsPerCoreInt;
1015
- result.performanceCores = threadsPerCoreInt > 1 ? result.cores - result.physicalCores : result.cores;
1016
- result.efficiencyCores = threadsPerCoreInt > 1 ? result.cores - threadsPerCoreInt * result.performanceCores : 0;
1017
- result.processors = processorsInt;
1018
- result.governor = util.getValue(lines, 'governor') || '';
1019
-
1020
- // Test Raspberry
1021
- if (result.vendor === 'ARM' && util.isRaspberry()) {
1022
- const rPIRevision = util.decodePiCpuinfo();
1023
- result.family = result.manufacturer;
1024
- result.manufacturer = rPIRevision.manufacturer;
1025
- result.brand = rPIRevision.processor;
1026
- result.revision = rPIRevision.revisionCode;
1027
- result.socket = 'SOC';
1028
- }
1029
-
1030
- // Test RISC-V
1031
- if (util.getValue(lines, 'architecture') === 'riscv64') {
1032
- try {
1033
- const linesRiscV = fs.readFileSync('/proc/cpuinfo').toString().split('\n');
1034
- const uarch = util.getValue(linesRiscV, 'uarch') || '';
1035
- if (uarch.indexOf(',') > -1) {
1036
- const split = uarch.split(',');
1037
- result.manufacturer = cpuManufacturer(split[0]);
1038
- result.brand = split[1];
1039
- }
1040
- } catch {
1041
- util.noop();
1042
- }
1043
- }
1044
-
1045
- // socket type
1046
- let lines2 = [];
1047
- exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL', (error2, stdout2) => {
1048
- lines2 = stdout2.toString().split('\n');
1049
- if (lines2 && lines2.length) {
1050
- result.socket = util.getValue(lines2, 'Upgrade').replace('Socket', '').trim() || result.socket;
1051
- }
1052
- resolve(result);
1053
- });
1054
- });
1055
- }
1056
- if (_freebsd || _openbsd || _netbsd) {
1057
- let modelline = '';
1058
- let lines = [];
1059
- if (os.cpus()[0] && os.cpus()[0].model) {
1060
- modelline = os.cpus()[0].model;
1061
- }
1062
- exec('export LC_ALL=C; dmidecode -t 4; dmidecode -t 7; unset LC_ALL', (error, stdout) => {
1063
- let cache = [];
1064
- if (!error) {
1065
- const data = stdout.toString().split('# dmidecode');
1066
- const processor = data.length > 1 ? data[1] : '';
1067
- cache = data.length > 2 ? data[2].split('Cache Information') : [];
1068
-
1069
- lines = processor.split('\n');
1070
- }
1071
- result.brand = modelline.split('@')[0].trim();
1072
- result.speed = modelline.split('@')[1] ? parseFloat(modelline.split('@')[1].trim()) : 0;
1073
- if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
1074
- result.speed = getAMDSpeed(result.brand);
1075
- }
1076
- if (result.speed === 0) {
1077
- const current = getCpuCurrentSpeedSync();
1078
- if (current.avg !== 0) {
1079
- result.speed = current.avg;
1080
- }
1081
- }
1082
- _cpu_speed = result.speed;
1083
- result.speedMin = result.speed;
1084
- result.speedMax = Math.round(parseFloat(util.getValue(lines, 'max speed').replace(/Mhz/g, '')) / 10.0) / 100 || result.speed;
1085
-
1086
- result = cpuBrandManufacturer(result);
1087
- result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer'));
1088
- let sig = util.getValue(lines, 'signature');
1089
- sig = sig.split(',');
1090
- for (let i = 0; i < sig.length; i++) {
1091
- sig[i] = sig[i].trim();
1092
- }
1093
- result.family = util.getValue(sig, 'Family', ' ', true);
1094
- result.model = util.getValue(sig, 'Model', ' ', true);
1095
- result.stepping = util.getValue(sig, 'Stepping', ' ', true);
1096
- result.revision = '';
1097
- const voltage = parseFloat(util.getValue(lines, 'voltage'));
1098
- result.voltage = isNaN(voltage) ? '' : voltage.toFixed(2);
1099
- for (let i = 0; i < cache.length; i++) {
1100
- lines = cache[i].split('\n');
1101
- let cacheType = util.getValue(lines, 'Socket Designation').toLowerCase().replace(' ', '-').split('-');
1102
- cacheType = cacheType.length ? cacheType[0] : '';
1103
- const sizeParts = util.getValue(lines, 'Installed Size').split(' ');
1104
- let size = parseInt(sizeParts[0], 10);
1105
- const unit = sizeParts.length > 1 ? sizeParts[1] : 'kb';
1106
- size = size * (unit === 'kb' ? 1024 : unit === 'mb' ? 1024 * 1024 : unit === 'gb' ? 1024 * 1024 * 1024 : 1);
1107
- if (cacheType) {
1108
- if (cacheType === 'l1') {
1109
- result.cache[cacheType + 'd'] = size / 2;
1110
- result.cache[cacheType + 'i'] = size / 2;
1111
- } else {
1112
- result.cache[cacheType] = size;
1113
- }
1114
- }
1115
- }
1116
- // socket type
1117
- result.socket = util.getValue(lines, 'Upgrade').replace('Socket', '').trim();
1118
- // # threads / # cores
1119
- const threadCount = util.getValue(lines, 'thread count').trim();
1120
- const coreCount = util.getValue(lines, 'core count').trim();
1121
- if (coreCount && threadCount) {
1122
- result.cores = parseInt(threadCount, 10);
1123
- result.physicalCores = parseInt(coreCount, 10);
1124
- }
1125
- resolve(result);
1126
- });
1127
- }
1128
- if (_sunos) {
1129
- resolve(result);
1130
- }
1131
- if (_windows) {
1132
- try {
1133
- const workload = [];
1134
- workload.push(
1135
- util.powerShell(
1136
- 'Get-CimInstance Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl'
1137
- )
1138
- );
1139
- workload.push(util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl'));
1140
- workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
1141
-
1142
- Promise.all(workload).then((data) => {
1143
- let lines = data[0].split('\r\n');
1144
- let name = util.getValue(lines, 'name', ':') || '';
1145
- if (name.indexOf('@') >= 0) {
1146
- result.brand = name.split('@')[0].trim();
1147
- result.speed = name.split('@')[1] ? parseFloat(name.split('@')[1].trim()) : 0;
1148
- _cpu_speed = result.speed;
1149
- } else {
1150
- result.brand = name.trim();
1151
- result.speed = 0;
1152
- }
1153
- result = cpuBrandManufacturer(result);
1154
- result.revision = util.getValue(lines, 'revision', ':');
1155
- result.vendor = util.getValue(lines, 'manufacturer', ':');
1156
- result.speedMax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', ':').replace(/,/g, '.')) / 10.0) / 100 || result.speedMax;
1157
- if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
1158
- result.speed = getAMDSpeed(result.brand);
1159
- }
1160
- if (result.speed === 0) {
1161
- result.speed = result.speedMax;
1162
- }
1163
- result.speedMin = result.speed;
1164
-
1165
- let description = util.getValue(lines, 'description', ':').split(' ');
1166
- for (let i = 0; i < description.length; i++) {
1167
- if (description[i].toLowerCase().startsWith('family') && i + 1 < description.length && description[i + 1]) {
1168
- result.family = description[i + 1];
1169
- }
1170
- if (description[i].toLowerCase().startsWith('model') && i + 1 < description.length && description[i + 1]) {
1171
- result.model = description[i + 1];
1172
- }
1173
- if (description[i].toLowerCase().startsWith('stepping') && i + 1 < description.length && description[i + 1]) {
1174
- result.stepping = description[i + 1];
1175
- }
1176
- }
1177
- // socket type
1178
- const socketId = util.getValue(lines, 'UpgradeMethod', ':');
1179
- if (socketTypes[socketId]) {
1180
- result.socket = socketTypes[socketId];
1181
- }
1182
- const socketByName = getSocketTypesByName(name);
1183
- if (socketByName) {
1184
- result.socket = socketByName;
1185
- }
1186
- // # threads / # cores
1187
- const countProcessors = util.countLines(lines, 'Caption');
1188
- const countThreads = util.getValue(lines, 'NumberOfLogicalProcessors', ':');
1189
- const countCores = util.getValue(lines, 'NumberOfCores', ':');
1190
- if (countProcessors) {
1191
- result.processors = parseInt(countProcessors) || 1;
1192
- }
1193
- if (countCores && countThreads) {
1194
- result.cores = parseInt(countThreads) || util.cores();
1195
- result.physicalCores = parseInt(countCores) || util.cores();
1196
- }
1197
- if (countProcessors > 1) {
1198
- result.cores = result.cores * countProcessors;
1199
- result.physicalCores = result.physicalCores * countProcessors;
1200
- }
1201
- result.cache = parseWinCache(data[0], data[1]);
1202
- const hyperv = data[2] ? data[2].toString().toLowerCase() : '';
1203
- result.virtualization = hyperv.indexOf('true') !== -1;
1204
-
1205
- resolve(result);
1206
- });
1207
- } catch (e) {
1208
- resolve(result);
1209
- }
1210
- }
1211
- });
1212
- });
1213
- });
1214
- }
1215
-
1216
- // --------------------------
1217
- // CPU - Processor Data
1218
-
1219
- function cpu(callback) {
1220
- return new Promise((resolve) => {
1221
- process.nextTick(() => {
1222
- getCpu().then((result) => {
1223
- if (callback) {
1224
- callback(result);
1225
- }
1226
- resolve(result);
1227
- });
1228
- });
1229
- });
1230
- }
1231
-
1232
- exports.cpu = cpu;
1233
-
1234
- // --------------------------
1235
- // CPU - current speed - in GHz
1236
-
1237
- function getCpuCurrentSpeedSync() {
1238
- const cpus = os.cpus();
1239
- let minFreq = 999999999;
1240
- let maxFreq = 0;
1241
- let avgFreq = 0;
1242
- const cores = [];
1243
- const speeds = [];
1244
-
1245
- if (cpus && cpus.length && Object.prototype.hasOwnProperty.call(cpus[0], 'speed')) {
1246
- for (let i in cpus) {
1247
- speeds.push(cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10);
1248
- }
1249
- } else if (_linux) {
1250
- try {
1251
- const speedStrings = execSync('cat /proc/cpuinfo | grep "cpu MHz" | cut -d " " -f 3', util.execOptsLinux)
1252
- .toString()
1253
- .split('\n')
1254
- .filter((line) => line.length > 0);
1255
- for (let i in speedStrings) {
1256
- speeds.push(Math.floor(parseInt(speedStrings[i], 10) / 10) / 100);
1257
- }
1258
- } catch {
1259
- util.noop();
1260
- }
1261
- }
1262
-
1263
- if (speeds && speeds.length) {
1264
- try {
1265
- for (const i in speeds) {
1266
- avgFreq = avgFreq + speeds[i];
1267
- if (speeds[i] > maxFreq) {
1268
- maxFreq = speeds[i];
1269
- }
1270
- if (speeds[i] < minFreq) {
1271
- minFreq = speeds[i];
1272
- }
1273
- cores.push(parseFloat(speeds[i].toFixed(2)));
1274
- }
1275
- avgFreq = avgFreq / speeds.length;
1276
- return {
1277
- min: parseFloat(minFreq.toFixed(2)),
1278
- max: parseFloat(maxFreq.toFixed(2)),
1279
- avg: parseFloat(avgFreq.toFixed(2)),
1280
- cores: cores
1281
- };
1282
- } catch (e) {
1283
- return {
1284
- min: 0,
1285
- max: 0,
1286
- avg: 0,
1287
- cores: cores
1288
- };
1289
- }
1290
- } else {
1291
- return {
1292
- min: 0,
1293
- max: 0,
1294
- avg: 0,
1295
- cores: cores
1296
- };
1297
- }
1298
- }
1299
-
1300
- function cpuCurrentSpeed(callback) {
1301
- return new Promise((resolve) => {
1302
- process.nextTick(() => {
1303
- let result = getCpuCurrentSpeedSync();
1304
- if (result.avg === 0 && _cpu_speed !== 0) {
1305
- const currCpuSpeed = parseFloat(_cpu_speed);
1306
- result = {
1307
- min: currCpuSpeed,
1308
- max: currCpuSpeed,
1309
- avg: currCpuSpeed,
1310
- cores: []
1311
- };
1312
- }
1313
- if (callback) {
1314
- callback(result);
1315
- }
1316
- resolve(result);
1317
- });
1318
- });
1319
- }
1320
-
1321
- exports.cpuCurrentSpeed = cpuCurrentSpeed;
1322
-
1323
- // --------------------------
1324
- // CPU - temperature
1325
- // if sensors are installed
1326
-
1327
- function cpuTemperature(callback) {
1328
- return new Promise((resolve) => {
1329
- process.nextTick(() => {
1330
- let result = {
1331
- main: null,
1332
- cores: [],
1333
- max: null,
1334
- socket: [],
1335
- chipset: null
1336
- };
1337
- if (_linux) {
1338
- // CPU Chipset, Socket
1339
- let cpuThermal = null;
1340
- try {
1341
- const cmd = 'cat /sys/class/thermal/thermal_zone*/type 2>/dev/null; echo "-----"; cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null;';
1342
- const parts = execSync(cmd, util.execOptsLinux).toString().split('-----\n');
1343
- if (parts.length === 2) {
1344
- const lines = parts[0].split('\n');
1345
- const lines2 = parts[1].split('\n');
1346
- for (let i = 0; i < lines.length; i++) {
1347
- const line = lines[i].trim();
1348
- if (line.startsWith('acpi') && lines2[i]) {
1349
- result.socket.push(Math.round(parseInt(lines2[i], 10) / 100) / 10);
1350
- }
1351
- if (line.startsWith('pch') && lines2[i]) {
1352
- result.chipset = Math.round(parseInt(lines2[i], 10) / 100) / 10;
1353
- }
1354
- // CPU thermal zone (e.g. cpu-thermal on Raspberry Pi)
1355
- if (cpuThermal === null && line.indexOf('cpu') !== -1 && lines2[i]) {
1356
- cpuThermal = Math.round(parseInt(lines2[i], 10) / 100) / 10;
1357
- }
1358
- }
1359
- }
1360
- } catch (e) {
1361
- util.noop();
1362
- }
1363
-
1364
- const cmd =
1365
- '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;';
1366
- try {
1367
- exec(cmd, (error, stdout) => {
1368
- stdout = stdout.toString();
1369
- const tdiePos = stdout.toLowerCase().indexOf('tdie');
1370
- if (tdiePos !== -1) {
1371
- stdout = stdout.substring(tdiePos);
1372
- }
1373
- const lines = stdout.split('\n');
1374
- let tctl = 0;
1375
- lines.forEach((line) => {
1376
- const parts = line.split('___');
1377
- const label = parts[0];
1378
- const value = parts.length > 1 && parts[1] ? parts[1] : '0';
1379
- if (value && label && label.toLowerCase() === 'tctl') {
1380
- tctl = result.main = Math.round(parseInt(value, 10) / 100) / 10;
1381
- }
1382
- if (value && (label === undefined || (label && label.toLowerCase().startsWith('core')))) {
1383
- result.cores.push(Math.round(parseInt(value, 10) / 100) / 10);
1384
- } else if (value && label && result.main === null && (label.toLowerCase().indexOf('package') >= 0 || label.toLowerCase().indexOf('physical') >= 0 || label.toLowerCase() === 'tccd1')) {
1385
- result.main = Math.round(parseInt(value, 10) / 100) / 10;
1386
- }
1387
- });
1388
- if (tctl && result.main === null) {
1389
- result.main = tctl;
1390
- }
1391
-
1392
- if (result.cores.length > 0) {
1393
- if (result.main === null) {
1394
- result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1395
- }
1396
- let maxtmp = Math.max.apply(Math, result.cores);
1397
- result.max = maxtmp > result.main ? maxtmp : result.main;
1398
- }
1399
- if (result.main !== null) {
1400
- if (result.max === null) {
1401
- result.max = result.main;
1402
- }
1403
- if (callback) {
1404
- callback(result);
1405
- }
1406
- resolve(result);
1407
- return;
1408
- }
1409
- if (cpuThermal !== null) {
1410
- result.main = cpuThermal;
1411
- result.max = cpuThermal;
1412
- if (callback) {
1413
- callback(result);
1414
- }
1415
- resolve(result);
1416
- return;
1417
- }
1418
- exec('sensors', (error, stdout) => {
1419
- if (!error) {
1420
- const lines = stdout.toString().split('\n');
1421
- let tdieTemp = null;
1422
- let cpuThermalTemp = null;
1423
- let newSectionStarts = true;
1424
- let section = '';
1425
-
1426
- lines.forEach((line) => {
1427
- // Section bestimmen
1428
- if (line.trim() === '') {
1429
- newSectionStarts = true;
1430
- } else if (newSectionStarts) {
1431
- const s = line.trim().toLowerCase();
1432
- if (s.startsWith('acpi')) section = 'acpi';
1433
- else if (s.startsWith('pch')) section = 'pch';
1434
- else if (s.startsWith('coretemp') || s.startsWith('core')) section = 'core';
1435
- else if (s.startsWith('k10temp')) section = 'coreAMD';
1436
- else if (s.startsWith('cpu_thermal') || s.startsWith('cpu-thermal') || s.startsWith('soc_thermal') || s.startsWith('cpu')) section = 'cpuThermal';
1437
- else section = 'other';
1438
- newSectionStarts = false;
1439
- }
1440
-
1441
- const regex = /[+-]([^°]*)/g;
1442
- const temps = line.match(regex);
1443
- const firstPart = line.split(':')[0].toUpperCase();
1444
-
1445
- if (section === 'acpi') {
1446
- // socket temp
1447
- if (firstPart.indexOf('TEMP') !== -1 && temps) {
1448
- result.socket.push(parseFloat(temps));
1449
- }
1450
- } else if (section === 'pch') {
1451
- // chipset temp
1452
- if (firstPart.indexOf('TEMP') !== -1 && !result.chipset && temps) {
1453
- result.chipset = parseFloat(temps);
1454
- }
1455
- }
1456
- // cpu temp
1457
- if ((firstPart.indexOf('PHYSICAL') !== -1 || firstPart.indexOf('PACKAGE') !== -1 || (section === 'coreAMD' && firstPart.indexOf('TDIE') !== -1)) && temps) {
1458
- result.main = parseFloat(temps);
1459
- }
1460
- if (firstPart.indexOf('CORE ') !== -1 && temps) {
1461
- result.cores.push(parseFloat(temps));
1462
- }
1463
- if (firstPart.indexOf('TDIE') !== -1 && tdieTemp === null && temps) {
1464
- tdieTemp = parseFloat(temps);
1465
- }
1466
-
1467
- // generic temp value from cpuThermal
1468
- if (section === 'cpuThermal' && firstPart.indexOf('TEMP') !== -1 && cpuThermalTemp === null && temps) {
1469
- cpuThermalTemp = parseFloat(temps);
1470
- }
1471
- });
1472
- if (result.cores.length > 0) {
1473
- result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1474
- const maxtmp = Math.max.apply(Math, result.cores);
1475
- result.max = maxtmp > result.main ? maxtmp : result.main;
1476
- } else {
1477
- // fallback order: cpu_thermal before tdie
1478
- if (result.main === null && cpuThermalTemp !== null) {
1479
- result.main = cpuThermalTemp;
1480
- result.max = cpuThermalTemp;
1481
- } else if (result.main === null && tdieTemp !== null) {
1482
- result.main = tdieTemp;
1483
- result.max = tdieTemp;
1484
- }
1485
- }
1486
- if (result.main !== null && result.max === null) {
1487
- result.max = result.main;
1488
- }
1489
- if (result.main !== null || result.max !== null) {
1490
- if (callback) {
1491
- callback(result);
1492
- }
1493
- resolve(result);
1494
- return;
1495
- }
1496
- }
1497
- fs.stat('/sys/class/thermal/thermal_zone0/temp', (err) => {
1498
- if (err === null) {
1499
- fs.readFile('/sys/class/thermal/thermal_zone0/temp', (error, stdout) => {
1500
- if (!error) {
1501
- const lines = stdout.toString().split('\n');
1502
- if (lines.length > 0) {
1503
- result.main = parseFloat(lines[0]) / 1000.0;
1504
- result.max = result.main;
1505
- }
1506
- }
1507
- if (callback) {
1508
- callback(result);
1509
- }
1510
- resolve(result);
1511
- });
1512
- } else {
1513
- exec('/opt/vc/bin/vcgencmd measure_temp', (error, stdout) => {
1514
- if (!error) {
1515
- const lines = stdout.toString().split('\n');
1516
- if (lines.length > 0 && lines[0].indexOf('=') !== -1) {
1517
- result.main = parseFloat(lines[0].split('=')[1]);
1518
- result.max = result.main;
1519
- }
1520
- }
1521
- if (callback) {
1522
- callback(result);
1523
- }
1524
- resolve(result);
1525
- });
1526
- }
1527
- });
1528
- });
1529
- });
1530
- } catch {
1531
- if (callback) {
1532
- callback(result);
1533
- }
1534
- resolve(result);
1535
- }
1536
- }
1537
- if (_freebsd || _openbsd || _netbsd) {
1538
- exec('sysctl dev.cpu | grep temp', (error, stdout) => {
1539
- if (!error) {
1540
- const lines = stdout.toString().split('\n');
1541
- let sum = 0;
1542
- lines.forEach((line) => {
1543
- const parts = line.split(':');
1544
- if (parts.length > 1) {
1545
- const temp = parseFloat(parts[1].replace(',', '.'));
1546
- if (temp > result.max) {
1547
- result.max = temp;
1548
- }
1549
- sum = sum + temp;
1550
- result.cores.push(temp);
1551
- }
1552
- });
1553
- if (result.cores.length) {
1554
- result.main = Math.round((sum / result.cores.length) * 100) / 100;
1555
- }
1556
- }
1557
- if (callback) {
1558
- callback(result);
1559
- }
1560
- resolve(result);
1561
- });
1562
- }
1563
- if (_darwin) {
1564
- try {
1565
- const osxTemp = require('osx-temperature-sensor');
1566
- result = osxTemp.cpuTemperature();
1567
- if (result.main) {
1568
- // round to 2 digits
1569
- result.main = Math.round(result.main * 100) / 100;
1570
- }
1571
- if (result.max) {
1572
- result.max = Math.round(result.max * 100) / 100;
1573
- }
1574
- if (result && result.cores && result.cores.length) {
1575
- for (let i = 0; i < result.cores.length; i++) {
1576
- result.cores[i] = Math.round(result.cores[i] * 100) / 100;
1577
- }
1578
- }
1579
- } catch {
1580
- util.noop();
1581
- }
1582
- try {
1583
- const macosTemp = require('macos-temperature-sensor');
1584
- const res = macosTemp.temperature();
1585
- if (res.cpu) {
1586
- // round to 2 digits
1587
- result.main = Math.round(res.cpu * 100) / 100;
1588
- result.max = result.main;
1589
- }
1590
- if (res.soc) {
1591
- // round to 2 digits
1592
- result.chipset = Math.round(res.soc * 100) / 100;
1593
- }
1594
- if (res && res.cpuDieTemps.length) {
1595
- for (const temp of res.cpuDieTemps) {
1596
- result.cores.push(Math.round(temp * 100) / 100);
1597
- }
1598
- }
1599
- } catch {
1600
- util.noop();
1601
- }
1602
-
1603
- if (callback) {
1604
- callback(result);
1605
- }
1606
- resolve(result);
1607
- }
1608
- if (_sunos) {
1609
- if (callback) {
1610
- callback(result);
1611
- }
1612
- resolve(result);
1613
- }
1614
- if (_windows) {
1615
- try {
1616
- util.powerShell('Get-CimInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | Select CurrentTemperature').then((stdout, error) => {
1617
- if (!error) {
1618
- let sum = 0;
1619
- const lines = stdout
1620
- .split('\r\n')
1621
- .filter((line) => line.trim() !== '')
1622
- .filter((line, idx) => idx > 0);
1623
- lines.forEach((line) => {
1624
- const value = (parseInt(line, 10) - 2732) / 10;
1625
- if (!isNaN(value)) {
1626
- sum = sum + value;
1627
- if (value > result.max) {
1628
- result.max = value;
1629
- }
1630
- result.cores.push(value);
1631
- }
1632
- });
1633
- if (result.cores.length) {
1634
- result.main = sum / result.cores.length;
1635
- }
1636
- }
1637
- if (callback) {
1638
- callback(result);
1639
- }
1640
- resolve(result);
1641
- });
1642
- } catch {
1643
- if (callback) {
1644
- callback(result);
1645
- }
1646
- resolve(result);
1647
- }
1648
- }
1649
- });
1650
- });
1651
- }
1652
-
1653
- exports.cpuTemperature = cpuTemperature;
1654
-
1655
- // --------------------------
1656
- // CPU Flags
1657
-
1658
- function cpuFlags(callback) {
1659
- return new Promise((resolve) => {
1660
- process.nextTick(() => {
1661
- let result = '';
1662
- if (_windows) {
1663
- try {
1664
- exec('reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet', util.execOptsWin, (error, stdout) => {
1665
- if (!error) {
1666
- let flag_hex = stdout.split('0x').pop().trim();
1667
- let flag_bin_unpadded = parseInt(flag_hex, 16).toString(2);
1668
- let flag_bin = '0'.repeat(32 - flag_bin_unpadded.length) + flag_bin_unpadded;
1669
- // empty flags are the reserved fields in the CPUID feature bit list
1670
- // as found on wikipedia:
1671
- // https://en.wikipedia.org/wiki/CPUID
1672
- let all_flags = [
1673
- 'fpu',
1674
- 'vme',
1675
- 'de',
1676
- 'pse',
1677
- 'tsc',
1678
- 'msr',
1679
- 'pae',
1680
- 'mce',
1681
- 'cx8',
1682
- 'apic',
1683
- '',
1684
- 'sep',
1685
- 'mtrr',
1686
- 'pge',
1687
- 'mca',
1688
- 'cmov',
1689
- 'pat',
1690
- 'pse-36',
1691
- 'psn',
1692
- 'clfsh',
1693
- '',
1694
- 'ds',
1695
- 'acpi',
1696
- 'mmx',
1697
- 'fxsr',
1698
- 'sse',
1699
- 'sse2',
1700
- 'ss',
1701
- 'htt',
1702
- 'tm',
1703
- 'ia64',
1704
- 'pbe'
1705
- ];
1706
- for (let f = 0; f < all_flags.length; f++) {
1707
- if (flag_bin[f] === '1' && all_flags[f] !== '') {
1708
- result += ' ' + all_flags[f];
1709
- }
1710
- }
1711
- result = result.trim().toLowerCase();
1712
- }
1713
- if (callback) {
1714
- callback(result);
1715
- }
1716
- resolve(result);
1717
- });
1718
- } catch {
1719
- if (callback) {
1720
- callback(result);
1721
- }
1722
- resolve(result);
1723
- }
1724
- }
1725
- if (_linux) {
1726
- try {
1727
- exec('export LC_ALL=C; lscpu; unset LC_ALL', (error, stdout) => {
1728
- if (!error) {
1729
- let lines = stdout.toString().split('\n');
1730
- lines.forEach((line) => {
1731
- if (line.split(':')[0].toUpperCase().indexOf('FLAGS') !== -1) {
1732
- result = line.split(':')[1].trim().toLowerCase();
1733
- }
1734
- });
1735
- }
1736
- if (!result) {
1737
- fs.readFile('/proc/cpuinfo', (error, stdout) => {
1738
- if (!error) {
1739
- let lines = stdout.toString().split('\n');
1740
- result = util.getValue(lines, 'features', ':', true).toLowerCase();
1741
- }
1742
- if (callback) {
1743
- callback(result);
1744
- }
1745
- resolve(result);
1746
- });
1747
- } else {
1748
- if (callback) {
1749
- callback(result);
1750
- }
1751
- resolve(result);
1752
- }
1753
- });
1754
- } catch {
1755
- if (callback) {
1756
- callback(result);
1757
- }
1758
- resolve(result);
1759
- }
1760
- }
1761
- if (_freebsd || _openbsd || _netbsd) {
1762
- exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL', (error, stdout) => {
1763
- const flags = [];
1764
- if (!error) {
1765
- const parts = stdout.toString().split('\tFlags:');
1766
- const lines = parts.length > 1 ? parts[1].split('\tVersion:')[0].split('\n') : [];
1767
- lines.forEach((line) => {
1768
- const flag = (line.indexOf('(') ? line.split('(')[0].toLowerCase() : '').trim().replace(/\t/g, '');
1769
- if (flag) {
1770
- flags.push(flag);
1771
- }
1772
- });
1773
- }
1774
- result = flags.join(' ').trim().toLowerCase();
1775
- if (callback) {
1776
- callback(result);
1777
- }
1778
- resolve(result);
1779
- });
1780
- }
1781
- if (_darwin) {
1782
- exec('sysctl machdep.cpu.features', (error, stdout) => {
1783
- if (!error) {
1784
- let lines = stdout.toString().split('\n');
1785
- if (lines.length > 0 && lines[0].indexOf('machdep.cpu.features:') !== -1) {
1786
- result = lines[0].split(':')[1].trim().toLowerCase();
1787
- }
1788
- }
1789
- if (callback) {
1790
- callback(result);
1791
- }
1792
- resolve(result);
1793
- });
1794
- }
1795
- if (_sunos) {
1796
- if (callback) {
1797
- callback(result);
1798
- }
1799
- resolve(result);
1800
- }
1801
- });
1802
- });
1803
- }
1804
-
1805
- exports.cpuFlags = cpuFlags;
1806
-
1807
- // --------------------------
1808
- // CPU Cache
1809
-
1810
- function cpuCache(callback) {
1811
- return new Promise((resolve) => {
1812
- process.nextTick(() => {
1813
- let result = {
1814
- l1d: null,
1815
- l1i: null,
1816
- l2: null,
1817
- l3: null
1818
- };
1819
- if (_linux) {
1820
- try {
1821
- exec('export LC_ALL=C; lscpu; unset LC_ALL', (error, stdout) => {
1822
- if (!error) {
1823
- const lines = stdout.toString().split('\n');
1824
- lines.forEach((line) => {
1825
- const parts = line.split(':');
1826
- if (parts[0].toUpperCase().indexOf('L1D CACHE') !== -1) {
1827
- result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : parts[1].indexOf('K') !== -1 ? 1024 : 1);
1828
- }
1829
- if (parts[0].toUpperCase().indexOf('L1I CACHE') !== -1) {
1830
- result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : parts[1].indexOf('K') !== -1 ? 1024 : 1);
1831
- }
1832
- if (parts[0].toUpperCase().indexOf('L2 CACHE') !== -1) {
1833
- result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : parts[1].indexOf('K') !== -1 ? 1024 : 1);
1834
- }
1835
- if (parts[0].toUpperCase().indexOf('L3 CACHE') !== -1) {
1836
- result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : parts[1].indexOf('K') !== -1 ? 1024 : 1);
1837
- }
1838
- });
1839
- }
1840
- if (callback) {
1841
- callback(result);
1842
- }
1843
- resolve(result);
1844
- });
1845
- } catch {
1846
- if (callback) {
1847
- callback(result);
1848
- }
1849
- resolve(result);
1850
- }
1851
- }
1852
- if (_freebsd || _openbsd || _netbsd) {
1853
- exec('export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL', (error, stdout) => {
1854
- let cache = [];
1855
- if (!error) {
1856
- const data = stdout.toString();
1857
- cache = data.split('Cache Information');
1858
- cache.shift();
1859
- }
1860
- for (let i = 0; i < cache.length; i++) {
1861
- const lines = cache[i].split('\n');
1862
- let cacheType = util.getValue(lines, 'Socket Designation').toLowerCase().replace(' ', '-').split('-');
1863
- cacheType = cacheType.length ? cacheType[0] : '';
1864
- const sizeParts = util.getValue(lines, 'Installed Size').split(' ');
1865
- let size = parseInt(sizeParts[0], 10);
1866
- const unit = sizeParts.length > 1 ? sizeParts[1] : 'kb';
1867
- size = size * (unit === 'kb' ? 1024 : unit === 'mb' ? 1024 * 1024 : unit === 'gb' ? 1024 * 1024 * 1024 : 1);
1868
- if (cacheType) {
1869
- if (cacheType === 'l1') {
1870
- result[cacheType + 'd'] = size / 2;
1871
- result[cacheType + 'i'] = size / 2;
1872
- } else {
1873
- result[cacheType] = size;
1874
- }
1875
- }
1876
- }
1877
- if (callback) {
1878
- callback(result);
1879
- }
1880
- resolve(result);
1881
- });
1882
- }
1883
- if (_darwin) {
1884
- exec('sysctl hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize', (error, stdout) => {
1885
- if (!error) {
1886
- let lines = stdout.toString().split('\n');
1887
- lines.forEach((line) => {
1888
- let parts = line.split(':');
1889
- if (parts[0].toLowerCase().indexOf('hw.l1icachesize') !== -1) {
1890
- result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1891
- }
1892
- if (parts[0].toLowerCase().indexOf('hw.l1dcachesize') !== -1) {
1893
- result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1894
- }
1895
- if (parts[0].toLowerCase().indexOf('hw.l2cachesize') !== -1) {
1896
- result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1897
- }
1898
- if (parts[0].toLowerCase().indexOf('hw.l3cachesize') !== -1) {
1899
- result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1900
- }
1901
- });
1902
- }
1903
- if (callback) {
1904
- callback(result);
1905
- }
1906
- resolve(result);
1907
- });
1908
- }
1909
- if (_sunos) {
1910
- if (callback) {
1911
- callback(result);
1912
- }
1913
- resolve(result);
1914
- }
1915
- if (_windows) {
1916
- try {
1917
- const workload = [];
1918
- workload.push(util.powerShell('Get-CimInstance Win32_processor | select L2CacheSize, L3CacheSize | fl'));
1919
- workload.push(util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl'));
1920
-
1921
- Promise.all(workload).then((data) => {
1922
- result = parseWinCache(data[0], data[1]);
1923
-
1924
- if (callback) {
1925
- callback(result);
1926
- }
1927
- resolve(result);
1928
- });
1929
- } catch {
1930
- if (callback) {
1931
- callback(result);
1932
- }
1933
- resolve(result);
1934
- }
1935
- }
1936
- });
1937
- });
1938
- }
1939
-
1940
- function parseWinCache(linesProc, linesCache) {
1941
- const result = {
1942
- l1d: null,
1943
- l1i: null,
1944
- l2: null,
1945
- l3: null
1946
- };
1947
-
1948
- // Win32_processor
1949
- let lines = linesProc.split('\r\n');
1950
- result.l1d = 0;
1951
- result.l1i = 0;
1952
- result.l2 = util.getValue(lines, 'l2cachesize', ':');
1953
- result.l3 = util.getValue(lines, 'l3cachesize', ':');
1954
- if (result.l2) {
1955
- result.l2 = parseInt(result.l2, 10) * 1024;
1956
- } else {
1957
- result.l2 = 0;
1958
- }
1959
- if (result.l3) {
1960
- result.l3 = parseInt(result.l3, 10) * 1024;
1961
- } else {
1962
- result.l3 = 0;
1963
- }
1964
-
1965
- // Win32_CacheMemory
1966
- const parts = linesCache.split(/\n\s*\n/);
1967
- let l1i = 0;
1968
- let l1d = 0;
1969
- let l2 = 0;
1970
- parts.forEach((part) => {
1971
- const lines = part.split('\r\n');
1972
- const cacheType = util.getValue(lines, 'CacheType');
1973
- const level = util.getValue(lines, 'Level');
1974
- const installedSize = util.getValue(lines, 'InstalledSize');
1975
- // L1 Instructions
1976
- if (level === '3' && cacheType === '3') {
1977
- result.l1i = result.l1i + parseInt(installedSize, 10) * 1024;
1978
- }
1979
- // L1 Data
1980
- if (level === '3' && cacheType === '4') {
1981
- result.l1d = result.l1d + parseInt(installedSize, 10) * 1024;
1982
- }
1983
- // L1 all
1984
- if (level === '3' && cacheType === '5') {
1985
- l1i = parseInt(installedSize, 10) / 2;
1986
- l1d = parseInt(installedSize, 10) / 2;
1987
- }
1988
- // L2
1989
- if (level === '4' && cacheType === '5') {
1990
- l2 = l2 + parseInt(installedSize, 10) * 1024;
1991
- }
1992
- });
1993
- if (!result.l1i && !result.l1d) {
1994
- result.l1i = l1i;
1995
- result.l1d = l1d;
1996
- }
1997
- if (l2) {
1998
- result.l2 = l2;
1999
- }
2000
- return result;
2001
- }
2002
-
2003
- exports.cpuCache = cpuCache;
2004
-
2005
- // --------------------------
2006
- // CPU - current load - in %
2007
-
2008
- function getLoad() {
2009
- return new Promise((resolve) => {
2010
- process.nextTick(() => {
2011
- const loads = os.loadavg().map((x) => {
2012
- return x / util.cores();
2013
- });
2014
- const avgLoad = parseFloat(Math.max.apply(Math, loads).toFixed(2));
2015
- let result = {};
2016
-
2017
- const now = Date.now() - _current_cpu.ms;
2018
- if (now >= 200) {
2019
- _current_cpu.ms = Date.now();
2020
- const cpus = os.cpus().map((cpu) => {
2021
- cpu.times.steal = 0;
2022
- cpu.times.guest = 0;
2023
- if (_windows) {
2024
- cpu.times.sys = Math.max(0, cpu.times.sys - cpu.times.irq);
2025
- }
2026
- return cpu;
2027
- });
2028
- let totalUser = 0;
2029
- let totalSystem = 0;
2030
- let totalNice = 0;
2031
- let totalIrq = 0;
2032
- let totalIdle = 0;
2033
- let totalSteal = 0;
2034
- let totalGuest = 0;
2035
- const cores = [];
2036
- _corecount = cpus && cpus.length ? cpus.length : 0;
2037
-
2038
- // linux: try to get other cpu stats
2039
- if (_linux) {
2040
- try {
2041
- const lines = execSync('cat /proc/stat 2>/dev/null | grep cpu', util.execOptsLinux).toString().split('\n');
2042
- if (lines.length > 1) {
2043
- lines.shift();
2044
- if (lines.length === cpus.length) {
2045
- for (let i = 0; i < lines.length; i++) {
2046
- let parts = lines[i].split(' ');
2047
- if (parts.length >= 10) {
2048
- const steal = parseFloat(parts[8]) || 0;
2049
- const guest = parseFloat(parts[9]) || 0;
2050
- cpus[i].times.steal = steal;
2051
- cpus[i].times.guest = guest;
2052
- }
2053
- }
2054
- }
2055
- }
2056
- } catch {
2057
- util.noop();
2058
- }
2059
- }
2060
-
2061
- for (let i = 0; i < _corecount; i++) {
2062
- const cpu = cpus[i].times;
2063
- totalUser += cpu.user;
2064
- totalSystem += cpu.sys;
2065
- totalNice += cpu.nice;
2066
- totalIdle += cpu.idle;
2067
- totalIrq += cpu.irq;
2068
- totalSteal += cpu.steal || 0;
2069
- totalGuest += cpu.guest || 0;
2070
- const tmpTick = _cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0;
2071
- const tmpLoad = _cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0;
2072
- const tmpUser = _cpus && _cpus[i] && _cpus[i].user ? _cpus[i].user : 0;
2073
- const tmpSystem = _cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0;
2074
- const tmpNice = _cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0;
2075
- const tmpIdle = _cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0;
2076
- const tmpIrq = _cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0;
2077
- const tmpSteal = _cpus && _cpus[i] && _cpus[i].steal ? _cpus[i].steal : 0;
2078
- const tmpGuest = _cpus && _cpus[i] && _cpus[i].guest ? _cpus[i].guest : 0;
2079
- _cpus[i] = cpu;
2080
- _cpus[i].totalTick = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest + _cpus[i].idle;
2081
- _cpus[i].totalLoad = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest;
2082
- _cpus[i].currentTick = _cpus[i].totalTick - tmpTick;
2083
- _cpus[i].load = _cpus[i].totalLoad - tmpLoad;
2084
- _cpus[i].loadUser = _cpus[i].user - tmpUser;
2085
- _cpus[i].loadSystem = _cpus[i].sys - tmpSystem;
2086
- _cpus[i].loadNice = _cpus[i].nice - tmpNice;
2087
- _cpus[i].loadIdle = _cpus[i].idle - tmpIdle;
2088
- _cpus[i].loadIrq = _cpus[i].irq - tmpIrq;
2089
- _cpus[i].loadSteal = _cpus[i].steal - tmpSteal;
2090
- _cpus[i].loadGuest = _cpus[i].guest - tmpGuest;
2091
- cores[i] = {};
2092
- const coreTick = _cpus[i].currentTick || 1;
2093
- cores[i].load = (_cpus[i].load / coreTick) * 100;
2094
- cores[i].loadUser = (_cpus[i].loadUser / coreTick) * 100;
2095
- cores[i].loadSystem = (_cpus[i].loadSystem / coreTick) * 100;
2096
- cores[i].loadNice = (_cpus[i].loadNice / coreTick) * 100;
2097
- cores[i].loadIdle = (_cpus[i].loadIdle / coreTick) * 100;
2098
- cores[i].loadIrq = (_cpus[i].loadIrq / coreTick) * 100;
2099
- cores[i].loadSteal = (_cpus[i].loadSteal / coreTick) * 100;
2100
- cores[i].loadGuest = (_cpus[i].loadGuest / coreTick) * 100;
2101
- cores[i].rawLoad = _cpus[i].load;
2102
- cores[i].rawLoadUser = _cpus[i].loadUser;
2103
- cores[i].rawLoadSystem = _cpus[i].loadSystem;
2104
- cores[i].rawLoadNice = _cpus[i].loadNice;
2105
- cores[i].rawLoadIdle = _cpus[i].loadIdle;
2106
- cores[i].rawLoadIrq = _cpus[i].loadIrq;
2107
- cores[i].rawLoadSteal = _cpus[i].loadSteal;
2108
- cores[i].rawLoadGuest = _cpus[i].loadGuest;
2109
- }
2110
- const totalTick = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest + totalIdle;
2111
- const totalLoad = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest;
2112
- const currentTick = totalTick - _current_cpu.tick || 1;
2113
- result = {
2114
- avgLoad: avgLoad,
2115
- currentLoad: ((totalLoad - _current_cpu.load) / currentTick) * 100,
2116
- currentLoadUser: ((totalUser - _current_cpu.user) / currentTick) * 100,
2117
- currentLoadSystem: ((totalSystem - _current_cpu.system) / currentTick) * 100,
2118
- currentLoadNice: ((totalNice - _current_cpu.nice) / currentTick) * 100,
2119
- currentLoadIdle: ((totalIdle - _current_cpu.idle) / currentTick) * 100,
2120
- currentLoadIrq: ((totalIrq - _current_cpu.irq) / currentTick) * 100,
2121
- currentLoadSteal: ((totalSteal - _current_cpu.steal) / currentTick) * 100,
2122
- currentLoadGuest: ((totalGuest - _current_cpu.guest) / currentTick) * 100,
2123
- rawCurrentLoad: totalLoad - _current_cpu.load,
2124
- rawCurrentLoadUser: totalUser - _current_cpu.user,
2125
- rawCurrentLoadSystem: totalSystem - _current_cpu.system,
2126
- rawCurrentLoadNice: totalNice - _current_cpu.nice,
2127
- rawCurrentLoadIdle: totalIdle - _current_cpu.idle,
2128
- rawCurrentLoadIrq: totalIrq - _current_cpu.irq,
2129
- rawCurrentLoadSteal: totalSteal - _current_cpu.steal,
2130
- rawCurrentLoadGuest: totalGuest - _current_cpu.guest,
2131
- cpus: cores
2132
- };
2133
- _current_cpu = {
2134
- user: totalUser,
2135
- nice: totalNice,
2136
- system: totalSystem,
2137
- idle: totalIdle,
2138
- irq: totalIrq,
2139
- steal: totalSteal,
2140
- guest: totalGuest,
2141
- tick: totalTick,
2142
- load: totalLoad,
2143
- ms: _current_cpu.ms,
2144
- currentLoad: result.currentLoad,
2145
- currentLoadUser: result.currentLoadUser,
2146
- currentLoadSystem: result.currentLoadSystem,
2147
- currentLoadNice: result.currentLoadNice,
2148
- currentLoadIdle: result.currentLoadIdle,
2149
- currentLoadIrq: result.currentLoadIrq,
2150
- currentLoadSteal: result.currentLoadSteal,
2151
- currentLoadGuest: result.currentLoadGuest,
2152
- rawCurrentLoad: result.rawCurrentLoad,
2153
- rawCurrentLoadUser: result.rawCurrentLoadUser,
2154
- rawCurrentLoadSystem: result.rawCurrentLoadSystem,
2155
- rawCurrentLoadNice: result.rawCurrentLoadNice,
2156
- rawCurrentLoadIdle: result.rawCurrentLoadIdle,
2157
- rawCurrentLoadIrq: result.rawCurrentLoadIrq,
2158
- rawCurrentLoadSteal: result.rawCurrentLoadSteal,
2159
- rawCurrentLoadGuest: result.rawCurrentLoadGuest
2160
- };
2161
- } else {
2162
- const cores = [];
2163
- for (let i = 0; i < _corecount; i++) {
2164
- cores[i] = {};
2165
- const coreTick = _cpus[i].currentTick || 1;
2166
- cores[i].load = (_cpus[i].load / coreTick) * 100;
2167
- cores[i].loadUser = (_cpus[i].loadUser / coreTick) * 100;
2168
- cores[i].loadSystem = (_cpus[i].loadSystem / coreTick) * 100;
2169
- cores[i].loadNice = (_cpus[i].loadNice / coreTick) * 100;
2170
- cores[i].loadIdle = (_cpus[i].loadIdle / coreTick) * 100;
2171
- cores[i].loadIrq = (_cpus[i].loadIrq / coreTick) * 100;
2172
- cores[i].loadSteal = (_cpus[i].loadSteal / coreTick) * 100;
2173
- cores[i].loadGuest = (_cpus[i].loadGuest / coreTick) * 100;
2174
- cores[i].rawLoad = _cpus[i].load;
2175
- cores[i].rawLoadUser = _cpus[i].loadUser;
2176
- cores[i].rawLoadSystem = _cpus[i].loadSystem;
2177
- cores[i].rawLoadNice = _cpus[i].loadNice;
2178
- cores[i].rawLoadIdle = _cpus[i].loadIdle;
2179
- cores[i].rawLoadIrq = _cpus[i].loadIrq;
2180
- cores[i].rawLoadSteal = _cpus[i].loadSteal;
2181
- cores[i].rawLoadGuest = _cpus[i].loadGuest;
2182
- }
2183
- result = {
2184
- avgLoad: avgLoad,
2185
- currentLoad: _current_cpu.currentLoad,
2186
- currentLoadUser: _current_cpu.currentLoadUser,
2187
- currentLoadSystem: _current_cpu.currentLoadSystem,
2188
- currentLoadNice: _current_cpu.currentLoadNice,
2189
- currentLoadIdle: _current_cpu.currentLoadIdle,
2190
- currentLoadIrq: _current_cpu.currentLoadIrq,
2191
- currentLoadSteal: _current_cpu.currentLoadSteal,
2192
- currentLoadGuest: _current_cpu.currentLoadGuest,
2193
- rawCurrentLoad: _current_cpu.rawCurrentLoad,
2194
- rawCurrentLoadUser: _current_cpu.rawCurrentLoadUser,
2195
- rawCurrentLoadSystem: _current_cpu.rawCurrentLoadSystem,
2196
- rawCurrentLoadNice: _current_cpu.rawCurrentLoadNice,
2197
- rawCurrentLoadIdle: _current_cpu.rawCurrentLoadIdle,
2198
- rawCurrentLoadIrq: _current_cpu.rawCurrentLoadIrq,
2199
- rawCurrentLoadSteal: _current_cpu.rawCurrentLoadSteal,
2200
- rawCurrentLoadGuest: _current_cpu.rawCurrentLoadGuest,
2201
- cpus: cores
2202
- };
2203
- }
2204
- resolve(result);
2205
- });
2206
- });
2207
- }
2208
-
2209
- function currentLoad(callback) {
2210
- return new Promise((resolve) => {
2211
- process.nextTick(() => {
2212
- if (_current_cpu.ms === 0) {
2213
- // no baseline yet (first call): prime the counters, then measure over a
2214
- // short interval instead of returning the average load since boot
2215
- getLoad().then(() => {
2216
- setTimeout(() => {
2217
- getLoad().then((result) => {
2218
- if (callback) {
2219
- callback(result);
2220
- }
2221
- resolve(result);
2222
- });
2223
- }, 500);
2224
- });
2225
- } else {
2226
- getLoad().then((result) => {
2227
- if (callback) {
2228
- callback(result);
2229
- }
2230
- resolve(result);
2231
- });
2232
- }
2233
- });
2234
- });
2235
- }
2236
-
2237
- exports.currentLoad = currentLoad;
2238
-
2239
- // --------------------------
2240
- // PS - full load
2241
- // since bootup
2242
-
2243
- function getFullLoad() {
2244
- return new Promise((resolve) => {
2245
- process.nextTick(() => {
2246
- const cpus = os.cpus();
2247
- let totalUser = 0;
2248
- let totalSystem = 0;
2249
- let totalNice = 0;
2250
- let totalIrq = 0;
2251
- let totalIdle = 0;
2252
-
2253
- let result = 0;
2254
-
2255
- if (cpus && cpus.length) {
2256
- for (let i = 0, len = cpus.length; i < len; i++) {
2257
- const cpu = cpus[i].times;
2258
- totalUser += cpu.user;
2259
- totalSystem += _windows ? Math.max(0, cpu.sys - cpu.irq) : cpu.sys;
2260
- totalNice += cpu.nice;
2261
- totalIrq += cpu.irq;
2262
- totalIdle += cpu.idle;
2263
- }
2264
- const totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser;
2265
- result = ((totalTicks - totalIdle) / totalTicks) * 100.0;
2266
- }
2267
- resolve(result);
2268
- });
2269
- });
2270
- }
2271
-
2272
- function fullLoad(callback) {
2273
- return new Promise((resolve) => {
2274
- process.nextTick(() => {
2275
- getFullLoad().then((result) => {
2276
- if (callback) {
2277
- callback(result);
2278
- }
2279
- resolve(result);
2280
- });
2281
- });
2282
- });
2283
- }
2284
-
2285
- exports.fullLoad = fullLoad;