views:

1318

answers:

5

Recently I have been having issues with Firefox 3 on Ubuntu Hardy Heron. I will click on a link and it will hang for a while. I don't know if its a bug in Firefox 3 or a page running too much client side JavaScript, but I would like to try and debug it a bit.

So, my question is, is there a way to have some kind of process explorer, or task manager sort of thing for Firefox 3? I would like to be able to see what tabs are using what percent of my processor via the JavaScript on that page (or anything in the page that is causing CPU/memory usage). Does anybody know of a plugin that does this, or something similar? Has anyone else done this kind of inspection another way?

I know about FireBug, but I can't imagine how I would use it to finger which tab is using a lot of resources.

Any suggestions or insights?

UPDATE: Thanks Orion for the info! It doesn't really answer the question of having such a process explorer, but I think it answers my problem, so I'll mark yours as the answer! I'm still interested in some kind of mechanism to see what my various tabs are doing with respect to memory and javascript time, so any such comments are still welcome!

+6  A: 

It's probably the awesome firefox3 fsync "bug", which is a giant pile of fail.

In summary

  • Firefox3 saves its bookmarks and history in an SQLite database
  • Every time you load a page it writes to this database several times
  • SQLite cares deeply that you don't lose your bookmarks, so each time it writes, instructs the kernel to flush it's database file to disk and ensure that it's fully written
  • Many variants of linux, when told to flush like that, flush EVERY FILE. This may take up to a minute or more if you have background tasks doing any kind of disk intensive stuff.
  • The kernel makes firefox wait while this flush happens, which locks up the UI.
Orion Edwards
+1  A: 

There's no "process explorer" kind of tool for Firefox; but there's http://developer.mozilla.org/en/docs/Venkman with profiling mode, which you could use to see the time spent by chrome (meaning non-content, that is not web-page) scripts.

From what I've read about it, DTrace might also be useful for this sort of thing, but it requires creating a custom build and possibly adding additional probes to the source. I haven't played with it myself yet.

Nickolay
A: 

There's a thorough discussion of this that explains all of the fsync related problems that affected pre-3.0 versions of FF. In general, I have not seen the behaviour since then either, and really it shouldn't be a problem at all if your system isn't also doing IO intensive tasks. Firebug/Venkman make for nice debuggers, but they would be painful for figuring out these kinds of problems for someone else's code, IMO.

I also wish that there was an easy way to look at CPU utilization in Firefox by tab, though, as I often find myself with FF eating 100% CPU, but no clue which part is causing the problem.

jsight
+1  A: 

So, my question is, is there a way to have some kind of process explorer, or task manager sort of thing for Firefox 3?

Because of the way Firefox is built this is not possible at the moment. But the new Internet Explorer 8 Beta 2 and the just announced Google Chrome browser are heading in that direction, so I suppose Firefox will be heading there too.

Here is a post ( Google Chrome Process Manager ),by John Resig from Mozilla and jQuery fame on the subject.

Pat
A: 

XUL Profiler is an awesome extension that can point out extensions and client side JS gone bananas CPU-wise. It does not work on a per-tab basis, but per-script (or so). You can normally relate those .js scripts to your tabs or extensions by hand.

It is also worth mentioning that Google Chrome has built-in a really good task manager that gives memory and CPU usage per tab, extension and plugin.

[XUL Profiler] is a Javascript profiler. It shows elapsed time in each method as a graph, as well as browser canvas zones redraws to help track down consuming CPU chunks of code.

Traces all JS calls and paint events in XUL and pages context. Builds an animation showing dynamically the canvas zones being redrawn.

Accolade