Skip to content

Commit

Permalink
Fix get userUsedPercent of cpuUsage is NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
vicanso committed Jun 21, 2017
1 parent e9af014 commit 7a2dcda
Show file tree
Hide file tree
Showing 4 changed files with 1,184 additions and 2 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
sudo: false
language: node_js
node_js:
- "8"
- "7"
- "6"
- "5"
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function getCpuUsage(previousValue, start) {
const total = Math.ceil(((delta[0] * 1e9) + delta[1]) / 1000);
const usedPercent = Math.round(((usage.user + usage.system) / total) * 100);
usage.usedPercent = usedPercent;
usage.userUsedPercent = Math.round((usage.use / total) * 100);
usage.userUsedPercent = Math.round((usage.user / total) * 100);
usage.systemUsedPercent = Math.round((usage.system / total) * 100);
usage.total = total;
return usage;
Expand Down

0 comments on commit 7a2dcda

Please sign in to comment.