[webkit-dev] Monitoring JavaScript execution time

Adam Roben aroben at apple.com
Wed May 21 14:08:49 PDT 2008


Hi Chuck-

Chuck Norris wrote:
> I'm working on a page load time monitoring tool using WebKit, and I'm 
> interested in suggestions from the community about how to monitor 
> JavaScript in particular.
>
> Using WebKit, I've got really good page element monitoring through use 
> of the WebFrameLoadDelegate and WebResourceLoadDelegate protocols.  
> This takes care of images, script and CSS files very nicely.  But 
> we're finding that ads loading with JavaScript are often a significant 
> part of our page load times, and I'm trying to get some visibility 
> into what's going on.  We suspect that Google Analytics code can 
> occasionally take longer than usual, too.  Specifically, I'm hoping to 
> be able to monitor the execution time of any JavaScript that runs at 
> page load time and therefore adds to the total page load experience.
>
> Does anyone have any suggestions for tacks I could take to solve 
> this?  One thought would be to add some sort of delegate protocol for 
> JavaScript that will let me monitor what's going on.  A more 
> brute-force method might be to custom compile JavaScriptCore to emit 
> the data I need some way.
>
> Any suggestions, thoughts, or warnings would be welcome.

Once <https://bugs.webkit.org/show_bug.cgi?id=14351>, you will be able 
to find this information in the Inspector's Resources panel. Also, once 
<https://bugs.webkit.org/show_bug.cgi?id=17227> is fixed (which should 
be sometime in the next few weeks), you could add calls to 
console.profile and console.profileEnd to see what JS functions are 
taking the most time. I don't think there's any current way to monitor 
when JavaScript is executing.

On a related note, have you tried using the Inspector's Resources panel 
to track when resources are loaded? It should show you the kinds of 
information that the WebFrameLoadDelegate and WebResourceLoadDelegate 
callbacks will give you.

-Adam



More information about the webkit-dev mailing list