feat: add process.getBlinkMemoryInfo() (#17762)

This commit is contained in:
Milan Burda 2019-05-30 11:50:35 +02:00 committed by Alexey Kuzmin
parent 2dbd2c07e4
commit a1226d75ff
6 changed files with 42 additions and 0 deletions

View file

@ -1927,6 +1927,7 @@ describe('BrowserWindow module', () => {
expect(test.hasCrash).to.be.true()
expect(test.hasHang).to.be.true()
expect(test.heapStatistics).to.be.an('object')
expect(test.blinkMemoryInfo).to.be.an('object')
expect(test.processMemoryInfo).to.be.an('object')
expect(test.systemVersion).to.be.a('string')
expect(test.cpuUsage).to.be.an('object')

View file

@ -38,6 +38,15 @@ describe('process module', () => {
})
})
describe('process.getBlinkMemoryInfo()', () => {
it('returns blink memory information object', () => {
const heapStats = process.getBlinkMemoryInfo()
expect(heapStats.allocated).to.be.a('number')
expect(heapStats.marked).to.be.a('number')
expect(heapStats.total).to.be.a('number')
})
})
describe('process.getProcessMemoryInfo()', async () => {
it('resolves promise successfully with valid data', async () => {
const memoryInfo = await process.getProcessMemoryInfo()

View file

@ -27,6 +27,7 @@
hasHang: typeof process.hang === 'function',
creationTime: invoke(() => process.getCreationTime()),
heapStatistics: invoke(() => process.getHeapStatistics()),
blinkMemoryInfo: invoke(() => process.getBlinkMemoryInfo()),
processMemoryInfo: invoke(() => process.getProcessMemoryInfo()),
systemMemoryInfo: invoke(() => process.getSystemMemoryInfo()),
systemVersion: invoke(() => process.getSystemVersion()),