diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e4f673..e1c94f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,7 @@ Other changes | Version | Date | Comment | | -------------- | -------------- | -------- | +| 3.31.0 | 2017-10-15 | extended windows support `cpuFlags()` (partially) | | 3.30.6 | 2017-10-05 | updated community profile | | 3.30.5 | 2017-10-05 | bugfix `users()` - parsing values on windows | | 3.30.4 | 2017-10-03 | bugfix `cpuTemperature()` - parsing values on windows | diff --git a/README.md b/README.md index fc23ce2..f6276de 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Simple system and OS information library for [node.js][nodejs-url] [![NPM Downloads][downloads-image]][downloads-url] [![Git Issues][issues-img]][issues-url] [![deps status][daviddm-img]][daviddm-url] + [![Caretaker][caretaker-image]][caretaker-url] [![MIT license][license-img]][license-url] ## Quick Start @@ -50,6 +51,7 @@ async function cpu() { ## News and Changes ### Latest Activity +- Version 3.31.0: extended windows support `cpuFlags()` (partially) - Version 3.30.0: extended `versions()` (added `yarn`, `gulp`, `grunt`, `tsc`, `git`) - Version 3.29.0: extended windows support `services()` - Version 3.28.0: extended windows support `processes()` @@ -601,6 +603,8 @@ All other trademarks are the property of their respective owners. [license-img]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square [npmjs-license]: https://img.shields.io/npm/l/systeminformation.svg?style=flat-square [changelog-url]: https://github.com/sebhildebrandt/systeminformation/blob/master/CHANGELOG.md +[caretaker-url]: https://github.com/sebhildebrandt +[caretaker-image]: https://img.shields.io/badge/caretaker-sebhildebrandt-blue.svg?style=flat-square [nodejs-url]: https://nodejs.org/en/ [docker-url]: https://www.docker.com/ diff --git a/docs/ISSUE_TEMPLATE.md b/docs/ISSUE_TEMPLATE.md index 79037ec..a66f549 100644 --- a/docs/ISSUE_TEMPLATE.md +++ b/docs/ISSUE_TEMPLATE.md @@ -1,10 +1,16 @@ -### Expected behavior and actual behavior. +### Expected behavior - - - -### Steps to reproduce the problem. +### Actual behavior + +- +- +- + +### Steps to reproduce the problem - - @@ -16,3 +22,6 @@ - operating system: - hardware: +### Problem and possible solution + +If you have a solution in mind (or any idea what could cause this issue), we would be happy, if you can describe it here ... diff --git a/lib/cpu.js b/lib/cpu.js index 8c779fa..960493b 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -394,10 +394,30 @@ function cpuFlags(callback) { process.nextTick(() => { let result = ''; if (_windows) { - if (callback) { callback(result) } - resolve(result); + exec(`reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet`, function (error, stdout) { + if (!error) { + let flag_hex = stdout.split("0x").pop().trim(); + let flag_bin_unpadded = parseInt(flag_hex, 16).toString(2); + let flag_bin = "0".repeat(32 - flag_bin_unpadded.length) + flag_bin_unpadded; + // empty flags are the reserved fields in the CPUID feature bit list + // as found on wikipedia: + // https://en.wikipedia.org/wiki/CPUID + let all_flags = [ + "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", + "", "sep", "mtrr", "pge", "mca", "cmov", "pat", "pse-36", "psn", "clfsh", + "", "ds", "acpi", "mmx", "fxsr", "sse", "sse2", "ss", "htt", "tm", "ia64", "pbe" + ] + for (let f = 0; f < all_flags.length; f++) { + if (flag_bin[f] === "1" && all_flags[f] !== "") { + result += " " + all_flags[f]; + } + } + result = result.trim(); + } + if (callback) { callback(result) } + resolve(result); + }); } - if (_linux) { exec("lscpu", function (error, stdout) { if (!error) {