test: use faster variant for rss

PR-URL: https://github.com/nodejs/node/pull/36839
Refs: https://github.com/nodejs/node/pull/34291
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Pooja D P 2021-01-07 04:35:48 -08:00 committed by Myles Borins
parent b40d35d649
commit 0243376cfc
No known key found for this signature in database
GPG Key ID: 933B01F40B5CA946

View File

@ -17,7 +17,7 @@ const receivedChunks = [];
const N = 250000;
const server = net.createServer(common.mustCall((socket) => {
baseRSS = process.memoryUsage().rss;
baseRSS = process.memoryUsage.rss();
socket.setNoDelay(true);
socket.on('data', (chunk) => {
@ -38,7 +38,7 @@ const server = net.createServer(common.mustCall((socket) => {
process.on('exit', () => {
global.gc();
const bytesPerChunk =
(process.memoryUsage().rss - baseRSS) / receivedChunks.length;
(process.memoryUsage.rss() - baseRSS) / receivedChunks.length;
// We should always have less than one page (usually ~ 4 kB) per chunk.
assert(bytesPerChunk < 650, `measured ${bytesPerChunk} bytes per chunk`);
});