1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
'use strict';
require('../common');
const assert = require('assert');
const rusage = process.resourceUsage();
const fields = [
'userCPUTime',
'systemCPUTime',
'maxRSS',
'sharedMemorySize',
'unsharedDataSize',
'unsharedStackSize',
'minorPageFault',
'majorPageFault',
'swappedOut',
'fsRead',
'fsWrite',
'ipcSent',
'ipcReceived',
'signalsCount',
'voluntaryContextSwitches',
'involuntaryContextSwitches',
];
assert.deepStrictEqual(Object.keys(rusage).sort(), fields.sort());
fields.forEach((n) => {
assert.strictEqual(typeof rusage[n], 'number', `${n} should be a number`);
assert(rusage[n] >= 0, `${n} should be above or equal 0`);
});
|