Question

In Safari 4, I am trying to use the profiler to see how the time is spent in the code that runs when the page loads.

  1. I enabled the profiler ("Start profiling JavaScript")
  2. I load the page.
  3. I stop the profiler.

At this point, this doesn't create a "profile" snapshot (while it does if I start the profiler after the page is loaded). Any hint on this?

Was it helpful?

Solution

For code inside onLoad handlers, you need to enable the profiler programmatically. Add console.profile() to the start of the relevant javascript, and console.profileEnd() to the end.

Read more here: Using the Web Inspector

It's very similar to FireBug's profiler: Console API

Update: The Web Inspector link above 404s. Here's a more current document: Web Inspector Guide: Timelines

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top