Firefox/Projects/Startup Time Improvements/joelr notes: Difference between revisions
Joel Reymont (talk | contribs) |
Joel Reymont (talk | contribs) |
||
| Line 5: | Line 5: | ||
= Current status = | = Current status = | ||
=== August | === August 25, 2009 === | ||
[http:// | Created a [http://github.com/wagerlabs/firefox-startup/blob/c0b7691c60eb0455d7475aa17777edcf3ed3d605/main-entry-probe.patch static probe that fires first thing in XRE_main] and updated my [http://github.com/wagerlabs/firefox-startup/tree/master DTrace scripts] to use it. | ||
pid$target::function:entry probes are very slow since the have to search, potentially, thousands of functions. A USDT (static) probe is just a few NOP instructions in the code that get fixed up by DTrace as needed. | |||
= Previous statuses = | |||
=== August 24, 2009 === | === August 24, 2009 === | ||
| Line 46: | Line 44: | ||
Digging deeper... | Digging deeper... | ||
=== August 21, 2009 === | |||
[http://wagerlabs.com/post/168237170/faster-mac-firefox Blogged]. | |||
My DTrace scripts live [http://github.com/wagerlabs/firefox-startup/tree/master here]. Use like this | |||
<pre> | |||
sudo ./cold.sh static-init.d | |||
</pre> | |||
= DTrace tips and tricks = | |||
=== DTrace: timestamp vs vtimestamp === | === DTrace: timestamp vs vtimestamp === | ||
Revision as of 22:07, 25 August 2009
Intro
I'm trying to figure out where Firefox startup time goes, up to the return from BrowserStartup (Javascript function). I'm also manipulating DTrace into telling me where time is going, without making any assumptions.
Current status
August 25, 2009
Created a static probe that fires first thing in XRE_main and updated my DTrace scripts to use it.
pid$target::function:entry probes are very slow since the have to search, potentially, thousands of functions. A USDT (static) probe is just a few NOP instructions in the code that get fixed up by DTrace as needed.
Previous statuses
August 24, 2009
Startup time is measured from the entry to XRE_main to the return of the BrowserStartup JS function. It takes a good bit of time but nothing compared to the time elapsed from the start of Firefox to the call to XRE_main.
According to my static-init.d script, the static initialization time can be ignored. I'm recording the library name and then timing the following call to ImageLoader::runInitializers in dyld. The cumulative time is too small to be of essence, though.
0.000053548s for /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/A/HIToolbox 0.000053732s for /Users/joelr/Work/mozilla/startup/./Minefield.app/Contents/MacOS/libsoftokn3.dylib 0.000069234s for /System/Library/PrivateFrameworks/Shortcut.framework/Versions/A/Shortcut 0.000070455s for /Users/joelr/Work/mozilla/startup/MinefieldRelease.app/Contents/MacOS/libnssckbi.dylib 0.000072754s for /Users/joelr/Work/mozilla/startup/MinefieldRelease.app/Contents/MacOS/components/libbrowsercomps.dylib 0.000073443s for /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Resources/ATSHI.dylib 0.000074363s for /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libCSync.A.dylib 0.000075845s for /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libCGATS.A.dylib 0.000076892s for /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libRIP.A.dylib 0.000089767s for /Users/joelr/Work/mozilla/startup/./Minefield.app/Contents/MacOS/libnssdbm3.dylib 0.000094390s for /Users/joelr/Work/mozilla/startup/./Minefield.app/Contents/MacOS/libfreebl3.dylib 0.000100462s for /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore 0.000115375s for /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox 0.001161267s for /Users/joelr/Work/mozilla/startup/MinefieldRelease.app/Contents/MacOS/components/libbrowserdirprovider.dylib --------------- = 0.002181527s Initialization: 42.986413480s Startup : 7.015292701s --------------- = 50.001706181s
Digging deeper...
August 21, 2009
My DTrace scripts live here. Use like this
sudo ./cold.sh static-init.d
DTrace tips and tricks
DTrace: timestamp vs vtimestamp
vtimestamp measures CPU time of the current thread, excluding IO and DTrace overhead. timestamp can still be used for deltas but the goal is to use as few pid$target probes as possible as they affect timestamp when dtrace has to switch between kernel and userland. io and syscall providers are fast and run in the kernel.
DTrace: Invalid address
Have you seen this kind of error before?
dtrace: error on enabled probe ID 27 (ID 22130: pid34547:libSystem.B.dylib:dlopen:entry): invalid address (0x2ac204) in action #1 at DIF offset 28 dtrace: error on enabled probe ID 2 (ID 22782: pid34547:dyld:dlopen:entry): invalid address (0x2ac204) in action #1 at DIF offset 28
More likely than not, you are using copyinstr on memory that hasn't been paged in yet. Try saving the pointer on entry and doing the copying on return or later.