diff options
| author | Geo Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2024-04-17 18:32:13 +0300 |
|---|---|---|
| committer | Geo Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2024-04-17 18:32:13 +0300 |
| commit | d9364679a51ff80db8e5948ab089d749da36a6b2 (patch) | |
| tree | f847a03a017be8857923aaaae9f8dcf7177b2ba9 /app/utils/mem-usage.js | |
| parent | 6248d2cf7a2214ac32628bc58248694108b4d8bf (diff) | |
| download | oseine-d9364679a51ff80db8e5948ab089d749da36a6b2.tar.gz oseine-d9364679a51ff80db8e5948ab089d749da36a6b2.tar.bz2 oseine-d9364679a51ff80db8e5948ab089d749da36a6b2.zip | |
dockerize the appHEADmasterdevelopment
Diffstat (limited to 'app/utils/mem-usage.js')
| -rw-r--r-- | app/utils/mem-usage.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/utils/mem-usage.js b/app/utils/mem-usage.js new file mode 100644 index 0000000..766a93e --- /dev/null +++ b/app/utils/mem-usage.js @@ -0,0 +1,20 @@ +/** + * memory usage report utility + */ + +const formatMemoryUsage = (data) => `${Math.round(data / 1024 / 1024 * 100) / 100} MB`; + +function report() { + let memoryData = process.memoryUsage(); + + let memoryUsage = { + rss: `${formatMemoryUsage(memoryData.rss)} -> Resident Set Size - total memory allocated for the process execution`, + heapTotal: `${formatMemoryUsage(memoryData.heapTotal)} -> total size of the allocated heap`, + heapUsed: `${formatMemoryUsage(memoryData.heapUsed)} -> actual memory used during the execution`, + external: `${formatMemoryUsage(memoryData.external)} -> V8 external memory`, + }; + + console.log(memoryUsage); +} + +module.exports = { report } |
