Using SlowCalls

From MozillaWiki
Revision as of 05:54, 1 November 2010 by Sfink (talk | contribs)
Jump to navigation Jump to search

This page documents the procedure for profiling the browser to produce output like http://people.mozilla.org/~sfink/slowcalls/slowcalls.html

Getting a tree with instrumentation

First, you need to get a tree containing Javascript instrumentation that is fully working. The easiest way to do this would be to clone http://people.mozilla.org/~sfink/src/slowcalls/

The only problem with this is that you won't have your own changes incorporated. If you need your changes, you could merge from the above tree (be sure your tree is based off of tracemonkey or it's guaranteed to be a total mess). Or you could apply everything in bug 605330 and bug 580055 and bug 558200.

As of this writing, the above tree is based off of tracemonkey's 5a6eceb273ab revision.

Building with instrumentation

You will need to configure with both --enable-functiontimer and --enable-trace-jscalls:

 ac_add_options --enable-trace-jscalls
 ac_add_options --enable-functiontimer

I've also been running with --enable-debug, which probably provides a lot more verbosity in the functiontimer logs. But I haven't tried without it, so I'm not sure.

 ac_add_options --enable-debug

Run your scenario

Set the following environment variables before running your scenario:

 NSPR_LOG_MODULES=JSDiagnostics:5
 NSPR_LOG_FILE=/tmp/minefield.log
 MOZ_FT=/tmp/minefield.tl

For example, I run with this command:

 NSPR_LOG_MODULES=JSDiagnostics:5 NSPR_LOG_FILE=/tmp/minefield.log MOZ_FT=/tmp/minefield.tl dist/bin/firefox -no-remote -P Blank

Exit the browser when done.

Produce the jscalls output

Run the 'process-jscall-logs' script from bug 558200 giving the two log files generated above as options, and the '-f slowcalls' flag:

 process-jscall-logs -f slowcalls /tmp/minefield.log /tmp/minefield.tl

(though if you're using the default names, you don't actually have to give them on the command line.) This will produce a file /tmp/slowcalls.html. Go to file:///tmp/slowcalls.html in a browser to view the output.