Skip to content

Commit 5690cd9

Browse files
committed
dep: Remove pidusage - unused
1 parent 81bff8e commit 5690cd9

File tree

5 files changed

+6
-84
lines changed

5 files changed

+6
-84
lines changed

lib/runner-sp.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ const createDispatcher = core.runner;
1313

1414
const A = require('async');
1515

16-
const pidusage = require('pidusage');
17-
1816
module.exports = createRunner;
1917

2018
function createRunner(script, payload, opts) {
@@ -74,31 +72,6 @@ Runner.prototype.run = function() {
7472
});
7573

7674
runner.run();
77-
78-
const MELTING_POINT = process.env.ARTILLERY_CPU_THRESHOLD || 90;
79-
const CPU_CHECK_INTERVAL_MS = 2500;
80-
const CPU_HOT_BEFORE_WARN = (process.env.CPU_HOT_BEFORE_WARN || 10) * 1000;
81-
let mpe = 0;
82-
83-
setInterval(
84-
function checkCPU() {
85-
pidusage.stat(process.pid, function(err, pidStats) {
86-
if (err) {
87-
debug(err);
88-
return;
89-
}
90-
91-
if (pidStats && pidStats.cpu && pidStats.cpu >= MELTING_POINT) {
92-
mpe++;
93-
}
94-
95-
if (mpe * CPU_CHECK_INTERVAL_MS >= CPU_HOT_BEFORE_WARN) {
96-
self.events.emit('highcpu', [process.pid]);
97-
mpe = 0;
98-
}
99-
});
100-
},
101-
CPU_CHECK_INTERVAL_MS).unref();
10275
}).catch(function(err) {
10376
// TODO: Handle the error
10477
console.log(err);

lib/runner.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const stats = require('./dispatcher').stats;
2121
const divideWork = require('./dist');
2222

2323
const A = require('async');
24-
const pidusage = require('pidusage');
2524

2625
module.exports = createRunner;
2726

@@ -115,36 +114,6 @@ Runner.prototype.run = function run() {
115114
this._sendStats.bind(this),
116115
this._script.config.statsInterval * 1000
117116
);
118-
119-
// Watch CPU usage of child processes:
120-
const MELTING_POINT = process.env.ARTILLERY_CPU_THRESHOLD || 90;
121-
const CPU_CHECK_INTERVAL_MS = 2500;
122-
const CPU_HOT_BEFORE_WARN = (process.env.CPU_HOT_BEFORE_WARN || 10) * 1000;
123-
let mpe = 0;
124-
setInterval(function() {
125-
A.map(
126-
Object.keys(self._workers),
127-
pidusage.stat,
128-
function cpuCollected(err, pidStats) {
129-
if (err) {
130-
return;
131-
}
132-
debug('cpu usage:', pidStats.map((o) => { return o.cpu; }));
133-
const busyPids = pidStats.filter(function(o) {
134-
return o && o.cpu && o.cpu >= MELTING_POINT;
135-
});
136-
if (busyPids.length > 0) {
137-
mpe++;
138-
}
139-
140-
if (mpe * CPU_CHECK_INTERVAL_MS >= CPU_HOT_BEFORE_WARN) {
141-
self.events.emit('highcpu', busyPids);
142-
mpe = 0;
143-
}
144-
debug('busyPids:', busyPids);
145-
});
146-
}, CPU_CHECK_INTERVAL_MS).unref();
147-
148117
return this;
149118
};
150119

package-lock.json

Lines changed: 6 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
"nanotimer": "^0.3.15",
6969
"opn": "^5.3.0",
7070
"ora": "^1.3.0",
71-
"pidusage": "^1.1.6",
7271
"posthog-node": "^1.1.3",
7372
"rc": "^1.1.6",
7473
"socket.io-client": "^2.1.0",

test/testcases/errors-and-warnings.bats

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@
2929
[[ true ]]
3030
}
3131

32-
@test "Warns when CPU usage exceeds a threshold" {
33-
CPU_HOT_BEFORE_WARN=1 ARTILLERY_CPU_THRESHOLD=-1 ./bin/artillery quick -d 10 -c 10 http://localhost:3003/ | grep 'CPU usage'
34-
[[ $? -eq 0 ]]
35-
}
36-
3732
@test "Exits with non zero when an unknown command is used" {
3833
run ./bin/artillery makemeasandwich --with cheese
3934
[[ $status -eq 1 ]]

0 commit comments

Comments
 (0)