* Prints memory usage report
()
| 71 | * Prints memory usage report |
| 72 | */ |
| 73 | report () { |
| 74 | console.log("\n📊 Memory Usage Report"); |
| 75 | console.log("-".repeat(50)); |
| 76 | |
| 77 | this.snapshots.forEach((snapshot, index) => { |
| 78 | console.log(`${index + 1}. ${snapshot.label}:`); |
| 79 | console.log(` RSS: ${this.formatBytes(snapshot.rss)}`); |
| 80 | console.log(` Heap Used: ${this.formatBytes(snapshot.heapUsed)}`); |
| 81 | console.log(` Heap Total: ${this.formatBytes(snapshot.heapTotal)}`); |
| 82 | console.log(` External: ${this.formatBytes(snapshot.external)}`); |
| 83 | |
| 84 | if (index > 0) { |
| 85 | const diff = this.diff(index - 1, index); |
| 86 | console.log(" Change from previous:"); |
| 87 | console.log(` RSS: ${this.formatBytes(diff.rss)}`); |
| 88 | console.log(` Heap Used: ${this.formatBytes(diff.heapUsed)}`); |
| 89 | } |
| 90 | console.log(""); |
| 91 | }); |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Clears all snapshots |
no test coverage detected