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