DTrace Mozilla - some browser image timings
By jmr on Sep 14, 2007
Well fired up by brendan gregg's dtrace enthusiasm I decided to get some load image probes in today. The load URI one's I blogged about yesterday had a nice clean entry point. The image one's not so The problem is that I could track the start of the image load requests in imgLoader::LoadImage, but it was hard to get the matching end points. Had you gone to a cache, had you gone to the net and so on.
Image Probe Points
Thankfully biesi on mozilla's irc #developers came to the rescue and pointed me at the imgRequest object. This is only created when you have to go out and fetch the image on the net, it's not in your cache. So I had a nice start and end point to work with, namely: imgRequest::OnStartRequest and imgRequest::OnStopRequest.
So with probes in these three places I can now track all image load requests and see how many had to go out on the net and how many have completed, along with timings. Makes it very easy to see how much you are or are not using your cache, as snippets from a few examples below show:
Hitting or not hitting the Cache
Loading http://www.smh.com.au/ with little or no caching:
LOAD PROBE STATS:
Total start loadImage's called 99
Total start imageRequest's called 87
Total done imageRequest's called 82
Loading about 20 tabs of various opensolaris and mozilla sites with lots of caching:
LOAD PROBE STATS:
Total start loadImage's called 696
Total start imageRequest's called 205
Total done imageRequest's called 203
The full listing of these examples and the timings of the load times for the images is available here. Just noticed a bug in the listing I'm getting 0 Counts in the Site summary for some images even though the timings are listed, ah well it's late and tomorrows another day Such are the joys of software ...
[17/09 - well looks like the script is fine, but the context I'm passing in as the unique identifier is not as unique as I'd hoped, so you can get the load-done probe fired on a given context before the load-start is fired. I had hoped to have the IMAGE_LOAD and IMAGE_REQUEST share the same context but that might not be possible, off to investigate.]
Next week I plan to get these new probes into an update of the load probe patch and will put it up on the bugzilla RFE for Dynamic Tracing [#370906]