Comparing version 1.1.5 to 1.1.6
@@ -132,3 +132,4 @@ var os = require('os') | ||
var self = this | ||
var uptime = os.uptime() | ||
// Note: On Windows the returned value includes fractions of a second. Use Math.floor() to get whole seconds. | ||
var uptime = Math.floor(os.uptime()) | ||
@@ -176,9 +177,13 @@ wmic.stdout.on('data', function(d) { | ||
var seconds = history.uptime !== undefined ? uptime - history.uptime : 0 | ||
seconds = Math.abs(seconds) | ||
seconds = seconds === 0 ? 1 : seconds //we sure can't divide through 0 | ||
var cpu = 0 | ||
if (seconds > 0) { | ||
cpu = (total / seconds) * 100 | ||
} | ||
self.history[pid] = stats | ||
self.history[pid].uptime = uptime | ||
return done(null, {cpu: (total / seconds) * 100, memory: workingsetsize}) | ||
return done(null, {cpu: cpu, memory: workingsetsize}) | ||
}) | ||
@@ -185,0 +190,0 @@ wmic.stdin.end() |
{ | ||
"name": "pidusage", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Cross-platform process cpu % and memory usage of a PID — Edit", | ||
@@ -12,2 +12,5 @@ "main": "index.js", | ||
}, | ||
"engines": { | ||
"node": ">=0.12" | ||
}, | ||
"scripts": { | ||
@@ -14,0 +17,0 @@ "test": "mocha test/test.js --reporter min && node test/stresstest.js" |
Sorry, the diff of this file is not supported yet
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
24203
432