How to profile web workers in Chrome?

耗尽温柔 提交于 2019-12-14 00:51:52

问题


Does anyone know an easy way to profile web workers in Chrome? I found this question from last year, but unfortunately the only provided answer didn't work.

Is there any way to do this or am I just out of look? It seems like a rather large oversight that hinders web development if you can't even do profiling.


回答1:


To profile Web Workers navigate to "Developer Tools -> Sources -> Workers" and enable the checkbox "Pause on start". Now, when you refresh the page, a popup window with an inspector for each worker will appear.

In the inspector window navigate to the "Profiles" tab and start your profiling. Now you have to switch back to the "Sources" tab and click the "Resume script executing" icon on the right-top icon bar.

This approach is not working for some older Chrome versions (Chrome 33 and below, compare Chromium Issue 180377) - there the inspector windows stay blank, except having a URL in the address bar. In Chrome 35 it is working for me.




回答2:


It appears that in newer versions of Chrome the Workers tab (in the debugger, nested in the "Sources" tab, on the right) has been merged into a "Threads" tab. I'm using Chrome Version 39.0.2171.95 m (up to date as of December 23, 2014).



来源:https://stackoverflow.com/questions/22511158/how-to-profile-web-workers-in-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!