Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d3a1fc
commit 283d650
Showing
11 changed files
with
454 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import fs from 'fs'; | ||
import { getHeapSnapshot } from 'v8'; | ||
|
||
export const dumpHeap = async (filePath: string) => | ||
new Promise<void>((resolve, reject) => { | ||
const snapshot = getHeapSnapshot(); | ||
const fileStream = fs.createWriteStream(filePath); | ||
snapshot.pipe(fileStream); | ||
|
||
fileStream.on('finish', () => { | ||
fileStream.end(); | ||
resolve(); | ||
}); | ||
fileStream.on('error', (err) => reject(err)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Arguments } from 'yargs'; | ||
import { DevHeapDumpRequest } from '../../proto/boltzrpc_pb'; | ||
import { callback, loadBoltzClient } from '../Command'; | ||
|
||
export const command = 'dev-heapdump [path]'; | ||
|
||
export const describe = 'dumps the heap of the daemon into a file'; | ||
|
||
export const builder = { | ||
path: { | ||
type: 'string', | ||
describe: 'path to which the heap should be dumped', | ||
}, | ||
}; | ||
|
||
export const handler = (argv: Arguments<any>): void => { | ||
const request = new DevHeapDumpRequest(); | ||
request.setPath(argv.path); | ||
|
||
loadBoltzClient(argv).devHeapDump(request, callback()); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.