xref: /third_party/node/test/parallel/test-resource-usage.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_cirequire('../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciconst rusage = process.resourceUsage();
61cb0ef41Sopenharmony_ciconst fields = [
71cb0ef41Sopenharmony_ci  'userCPUTime',
81cb0ef41Sopenharmony_ci  'systemCPUTime',
91cb0ef41Sopenharmony_ci  'maxRSS',
101cb0ef41Sopenharmony_ci  'sharedMemorySize',
111cb0ef41Sopenharmony_ci  'unsharedDataSize',
121cb0ef41Sopenharmony_ci  'unsharedStackSize',
131cb0ef41Sopenharmony_ci  'minorPageFault',
141cb0ef41Sopenharmony_ci  'majorPageFault',
151cb0ef41Sopenharmony_ci  'swappedOut',
161cb0ef41Sopenharmony_ci  'fsRead',
171cb0ef41Sopenharmony_ci  'fsWrite',
181cb0ef41Sopenharmony_ci  'ipcSent',
191cb0ef41Sopenharmony_ci  'ipcReceived',
201cb0ef41Sopenharmony_ci  'signalsCount',
211cb0ef41Sopenharmony_ci  'voluntaryContextSwitches',
221cb0ef41Sopenharmony_ci  'involuntaryContextSwitches',
231cb0ef41Sopenharmony_ci];
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ciassert.deepStrictEqual(Object.keys(rusage).sort(), fields.sort());
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_cifields.forEach((n) => {
281cb0ef41Sopenharmony_ci  assert.strictEqual(typeof rusage[n], 'number', `${n} should be a number`);
291cb0ef41Sopenharmony_ci  assert(rusage[n] >= 0, `${n} should be above or equal 0`);
301cb0ef41Sopenharmony_ci});
31

Indexes created Thu Nov 07 10:32:03 CST 2024