electron-userland / spectron

DEPRECATED: 🔎 Test Electron apps using ChromeDriver
http://electronjs.org/spectron
MIT License
1.68k stars 229 forks source link

Access to memory and other performance data #145

Closed taboca closed 7 years ago

taboca commented 7 years ago

I am interested in incorporating tests, or any watching mechanism, for monitoring memory associated with the spectron client-> electron. I wonder your opinion if this a) can be interesting and b) how can I start working with any workaround solutions.

My first attempt was to do this:

        console.log('Memory: ' , app.mainProcess.getSystemMemoryInfo());
        console.log('Memory: ' , app.rendererProcess.getProcessMemoryInfo());

But these calls are generating the following outputs:

Memory:  { state: 'pending' }
Memory:  { state: 'pending' }

I also see other features in Electron, such as the following:

https://github.com/electron/electron/blob/master/docs/api/content-tracing.md

Therefore I wonder what would be the ideal set of functions for one that is not only interested in testing ins and outs but also performance.

MarshallOfSound commented 7 years ago

@taboca All functions in Spectron return promises. Try doing

app.rendererProcess.getProcessMemoryInfo().then((info)=> console.log(info))
kevinsawicki commented 7 years ago

Closing this out, using @MarshallOfSound's example should work for accessing those Electron APIs.