7

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?

avernet
  • 30,895
  • 44
  • 126
  • 163
  • 1
    I'm also interested in this. I can profile an action without reload (ie. dragging a google map) but if I start it then reload the page, it doesn't create a profile, what use is that?) – brad Jul 07 '09 at 18:41

1 Answers1

8

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

Brendan Berg
  • 1,918
  • 2
  • 19
  • 22
ferbs
  • 721
  • 1
  • 5
  • 8