Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to profile web workers in Chrome?

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.

like image 478
Antimony Avatar asked Mar 19 '14 15:03

Antimony


2 Answers

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.

like image 129
david Avatar answered Oct 25 '22 18:10

david


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).

like image 23
Devin Avatar answered Oct 25 '22 18:10

Devin