Socket
Socket
Sign inDemoInstall

pidusage

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pidusage - npm Package Compare versions

Comparing version 2.0.17 to 2.0.18

6

lib/helpers/cpu.js

@@ -55,6 +55,6 @@ var os = require('os')

function getClockTick (cb) {
getconf('CLK_TCK', {default: 100}, cb)
getconf('CLK_TCK', { default: 100 }, cb)
},
function getPageSize (cb) {
getconf('PAGESIZE', {default: 4096}, cb)
getconf('PAGESIZE', { default: 4096 }, cb)
}

@@ -64,3 +64,3 @@ ], function (err, data) {

next(null, {clockTick: data[0], pageSize: data[1]})
next(null, { clockTick: data[0], pageSize: data[1] })
})

@@ -67,0 +67,0 @@ }

@@ -72,3 +72,3 @@ 'use strict'

function deleteLoop (obj) { for (let i in obj) { delete obj[i] } }
function deleteLoop (obj) { for (const i in obj) { delete obj[i] } }

@@ -75,0 +75,0 @@ function clear () {

@@ -59,3 +59,3 @@ var fs = require('fs')

if (err.code === 'ENOENT') {
err.message = 'No maching pid found'
err.message = 'No matching pid found'
}

@@ -86,9 +86,9 @@ return done(err, null)

ppid: parseInt(infos[1]),
utime: parseFloat(infos[11]),
stime: parseFloat(infos[12]),
cutime: parseFloat(infos[13]),
cstime: parseFloat(infos[14]),
start: parseFloat(infos[19]) / cpuInfo.clockTick,
utime: parseFloat(infos[11]) * 1000 / cpuInfo.clockTick,
stime: parseFloat(infos[12]) * 1000 / cpuInfo.clockTick,
cutime: parseFloat(infos[13]) * 1000 / cpuInfo.clockTick,
cstime: parseFloat(infos[14]) * 1000 / cpuInfo.clockTick,
start: parseFloat(infos[19]) * 1000 / cpuInfo.clockTick,
rss: parseFloat(infos[21]),
uptime: cpuInfo.uptime,
uptime: cpuInfo.uptime * 1000,
fd: fd

@@ -102,3 +102,3 @@ }

// process usage since last call in seconds
var total = (stat.stime - (hst.stime || 0) + stat.utime - (hst.utime || 0) + childrens) / cpuInfo.clockTick
var total = (stat.stime - (hst.stime || 0) + stat.utime - (hst.utime || 0) + childrens)
// time elapsed between calls in seconds

@@ -117,4 +117,4 @@ var seconds = Math.abs(hst.uptime !== undefined ? stat.uptime - hst.uptime : stat.start - stat.uptime)

memory: memory,
ctime: (stat.utime + stat.stime) / cpuInfo.clockTick,
elapsed: (stat.uptime * 1000) - (stat.start * 1000), // process uptime minus start time
ctime: stat.utime + stat.stime,
elapsed: stat.uptime - stat.start,
timestamp: date,

@@ -141,3 +141,3 @@ pid: pid,

parallel(fns, {graceful: true}, done)
parallel(fns, { graceful: true }, done)
})

@@ -144,0 +144,0 @@ }

@@ -48,3 +48,3 @@ 'use strict'

if (code === 1) {
return done(new Error('No maching pid found'))
return done(new Error('No matching pid found'))
}

@@ -51,0 +51,0 @@ if (code !== 0) {

@@ -8,2 +8,3 @@ 'use strict'

aix: 'ps',
android: 'procfile',
alpine: 'procfile',

@@ -10,0 +11,0 @@ darwin: 'ps',

@@ -48,6 +48,6 @@ 'use strict'

bin('wmic', args, {windowsHide: true, windowsVerbatimArguments: true}, function (err, stdout, code) {
bin('wmic', args, { windowsHide: true, windowsVerbatimArguments: true }, function (err, stdout, code) {
if (err) {
if (err.message.indexOf('No Instance(s) Available.') !== -1) {
return done(new Error('No maching pid found'))
return done(new Error('No matching pid found'))
}

@@ -99,3 +99,3 @@ return done(err)

again = true
hst = {ctime: kerneltime + usertime, uptime: uptime}
hst = { ctime: kerneltime + usertime, uptime: uptime }
}

@@ -109,3 +109,3 @@

history.set(pid, {ctime: usertime + kerneltime, uptime: uptime}, options.maxage)
history.set(pid, { ctime: usertime + kerneltime, uptime: uptime }, options.maxage)

@@ -112,0 +112,0 @@ statistics[pid] = {

{
"name": "pidusage",
"version": "2.0.17",
"version": "2.0.18",
"description": "Cross-platform process cpu % and memory usage of a PID",

@@ -21,7 +21,7 @@ "license": "MIT",

"engines": {
"node": ">=4"
"node": ">=8"
},
"scripts": {
"lint": "standard",
"test": "standard && nyc ava -m \"!*benchmark*\"",
"test": "nyc ava -m \"!*benchmark*\"",
"alpine": "docker run -v $(pwd):/var/pidusage pidusage:latest npm test",

@@ -35,9 +35,9 @@ "coverage": "codecov",

"devDependencies": {
"ava": "*",
"ava": "^2.4.0",
"codecov": "^3.0.2",
"mockdate": "^2.0.2",
"mockery": "2.1.0",
"nyc": "13.0.0",
"mockery": "^2.1.0",
"nyc": "^13.0.0",
"pify": "^3.0.0",
"standard": "*",
"standard": "^14.3.1",
"string-to-stream": "^1.1.0",

@@ -44,0 +44,0 @@ "through": "^2.3.8",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc