systeminformation
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -174,8 +174,9 @@ // ================================================================================== | ||
// -------------------------- | ||
// CPU - data | ||
// CPU - brand, speed | ||
exports.cpu = function(callback) { | ||
function getcpu(callback) { | ||
var result = { | ||
brand : 'unknown', | ||
speed : 'unknown' | ||
speed : 'unknown', | ||
cores : tmp_cores | ||
}; | ||
@@ -209,2 +210,29 @@ // grep "^model name" /proc/cpuinfo 2>/dev/null || sysctl -n machdep.cpu.brand_string | ||
// -------------------------- | ||
// CPU - Processor cores | ||
function cores(callback) { | ||
exec("grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu", function(error, stdout, stderr) { | ||
var result = {cores: 1}; | ||
if (!error) { | ||
result.cores = parseInt(stdout.toString()); | ||
tmp_cores = result.cores; | ||
} | ||
if (callback) callback(result); | ||
}); | ||
} | ||
// -------------------------- | ||
// CPU - Processor Data | ||
exports.cpu = function(callback) { | ||
if (tmp_cores == 0) { | ||
cores(function(data) { | ||
getcpu(callback) | ||
}) | ||
} else { | ||
getcpu(callback) | ||
} | ||
} | ||
// -------------------------- | ||
// CPU - current speed | ||
@@ -238,18 +266,2 @@ | ||
// -------------------------- | ||
// CPU - Processor cores | ||
function cores(callback) { | ||
exec("grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu", function(error, stdout, stderr) { | ||
var result = {cores: 1}; | ||
if (!error) { | ||
result.cores = parseInt(stdout.toString()); | ||
tmp_cores = result.cores; | ||
} | ||
if (callback) callback(result); | ||
}); | ||
} | ||
exports.cores = cores; | ||
// -------------------------- | ||
// CPU - temperature | ||
@@ -256,0 +268,0 @@ // if sensors are installed |
{ | ||
"name": "systeminformation", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Simple system and OS information library", | ||
@@ -5,0 +5,0 @@ "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)", |
@@ -66,4 +66,4 @@ # systeminformation | ||
| - speed | X | X | e.g. '3.40GHz' | | ||
| - cores | X | X | # cores | | ||
| si.cpu_currentspeed() | X | X | current speed (GHz)| | ||
| si.cores() | X | X | # cores | | ||
| si.cpu_temperature() | X | | CPU temperature (if sensors is installed) | | ||
@@ -131,2 +131,5 @@ | - main | X | X | main temperature | | ||
| -------------- | -------------- | -------- | | ||
| 1.0.3 | 2015-07-18 | bugfix cpu cores | | ||
| 1.0.2 | 2015-07-18 | bugfix cpu_currentspeed, cpu_temperature | | ||
| 1.0.1 | 2015-07-18 | documentation update | | ||
| 1.0.0 | 2015-07-18 | bug-fixes, version bumb, published as npm component | | ||
@@ -177,3 +180,4 @@ | 0.0.3 | 2014-04-14 | bug-fix (cpu_speed) | | ||
> | ||
>Further details see LICENSE(LICENSE) file. | ||
>Further details see LICENSE file. | ||
MIT(LICENSE) | ||
@@ -180,0 +184,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30516
631
185