Skip to content

Commit

Permalink
feature(progress): adds resident set size & v8 managed memory to the …
Browse files Browse the repository at this point in the history
…performance-log
  • Loading branch information
sverweij committed Dec 19, 2022
1 parent 3b2c617 commit 3836d20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/cli/listeners/performance-log/format-helpers.js
Expand Up @@ -19,8 +19,10 @@ function formatMemory(pBytes) {

function formatPerfLine(pTime, pPreviousTime, pMessage) {
return `${formatTime(pTime - pPreviousTime)} ${formatMemory(
process.memoryUsage().heapTotal
)} ${formatMemory(process.memoryUsage().heapUsed)} ${pMessage}\n`;
process.memoryUsage().rss
)} ${formatMemory(process.memoryUsage().heapTotal)} ${formatMemory(
process.memoryUsage().heapUsed
)} ${formatMemory(process.memoryUsage().external)} ${pMessage}\n`;
}

module.exports = {
Expand Down
4 changes: 3 additions & 1 deletion src/cli/listeners/performance-log/handlers.js
Expand Up @@ -3,7 +3,9 @@ const { formatTime, formatPerfLine } = require("./format-helpers");

function getHeader(pLevel, pMaxLevel) {
if (pLevel <= pMaxLevel) {
return chalk.bold(" elapsed heapTotal heapUsed after step...\n");
return chalk.bold(
" elapsed rss heapTotal heapUsed external after step...\n"
);
}
return "";
}
Expand Down
Expand Up @@ -58,6 +58,8 @@ describe("[U] cli/ears/performance-log-listener/format-helpers - formatPerfLine"
it("produces neat columns with time, memmory and a message", () => {
expect(
formatHelpers.formatPerfLine(14.88041018, 7.245436738, "sim sala bim")
).to.match(/ {3}7635ms {0,}\d+Mb {0,}\d+Mb sim sala bim\n/);
).to.match(
/ {3}7635ms {0,}\d+Mb {0,}\d+Mb {0,}\d+Mb {0,}\d+Mb sim sala bim\n/
);
});
});

0 comments on commit 3836d20

Please sign in to comment.