-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
process: expose uv_rusage on process.resourcesUsage()
As discussed in nodejs/diagnostics#161, the core should expose important metrics about the runtime, this PR's goal is to let user get the number of io request made, and lower level mertrics like the page faults and context switches. PR-URL: #28018 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
- Loading branch information
Showing
5 changed files
with
176 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('assert'); | ||
|
||
const rusage = process.resourceUsage(); | ||
|
||
[ | ||
'userCPUTime', | ||
'systemCPUTime', | ||
'maxRSS', | ||
'sharedMemorySize', | ||
'unsharedDataSize', | ||
'unsharedStackSize', | ||
'minorPageFault', | ||
'majorPageFault', | ||
'swappedOut', | ||
'fsRead', | ||
'fsWrite', | ||
'ipcSent', | ||
'ipcReceived', | ||
'signalsCount', | ||
'voluntaryContextSwitches', | ||
'involuntaryContextSwitches' | ||
].forEach((n) => { | ||
assert.strictEqual(typeof rusage[n], 'number', `${n} should be a number`); | ||
assert(rusage[n] >= 0, `${n} should be above or equal 0`); | ||
}); |