Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const memory: any[] = [];
- const showMemoryUsage = () => {
- // eslint-disable-next-line no-console
- console.clear();
- const bytesToMb = bytes => Math.round(bytes / 1000) / 1000;
- const usage = process.memoryUsage();
- const row = {
- rss: bytesToMb(usage.rss),
- heapTotal: bytesToMb(usage.heapTotal),
- heapUsed: bytesToMb(usage.heapUsed),
- external: bytesToMb(usage.external),
- stack: bytesToMb(usage.rss - usage.heapTotal - usage.external),
- };
- memory.push(row);
- // eslint-disable-next-line no-console
- console.table(memory);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement