Why is there no process viewer in Firefox?

Mar 10, 06:41 PM by David Caldwell

As I sit here right now my laptop is uncomfortably hot and its fans are making a really loud high pitched whine. Something on my computer is spinning the CPU and it’s making me literally hot. I look at the processes and FireFox is taking between 40% and 80% of the CPU! I’m basically sitting idle too. Well, right now I’m typing this message in Firefox, but 5 minutes ago the computer was sitting unattended and it was still going nuts.

Ok, so Firefox is wigging. But why? I can’t find any way to do some introspection. I suspect it’s one or two errant pages sitting in a tight javascript or flash loop. But how can I find out which pages? I have 26 windows open and most windows have multiple tabs open each (one has 30 tabs). Each of them is open for a reason—some unfinished business I have at each page, so I can’t just close them randomly. Besides, that would admit defeat.

What I need is a plug-in that monitors all the javascript and plugins that are running and keeps track of how long each runs. Then I want a unix top-like view of all the open pages and how many resources each is consuming (how much memory, how much cpu time their javascript is taking, etc). Why doesn’t this already exist? Sadly I just don’t have time right now to write such a thing, considering how much I’d have to first learn about the internal workings of Mozilla threads (I assume they are all green threads, because something is running so much my typing has a significant delay every few seconds).

Please, please, please (let me get what I want) won’t somebody write something like this? How do you Mozilla developers work? Is there a Javascript profiler available already? I’ve searched the add-ons before but I can’t find anything like this.

All I know is my lap is getting hot and I can’t do anything about it because I need Firefox open right now and it’s beginning to really annoy me.

Tell the world: technorati related  |  del.icio.us bookmark it!  |  digg digg it!  |  reddit reddit!

  1. Easy – Microsoft and/or Opera hasn’t written one yet for them to copy.

    As soon as someone else does it Mozilla will copy it.

    Mozilla – no original ideas (and no memory leaks) for 5+ years!


    — EasyAnswer    Mar 10, 07:23 PM    #
  2. While it does not give you a JavaScript top at this time, Firebug sure seems as the way towards a solution – http://www.getfirebug.com/

    And if you have to actually tab through your pages to see what is happening, you could probably implement the feature thought the API or request it at their wiki.

    To EasyAnswer: I am not able to discuss originality, but if you know of an extension comparable to Firebug for another browser (not talking of Firebug Lite), it could be really useful. :-)

    Best regards,
    -fb


    — Fartingbrass    Mar 11, 12:41 AM    #
  3. try firefox nightly builds.


    — baczek    Mar 11, 01:07 AM    #
  4. @anonymcowardaboveme

    Yes, yes FF 1 copied tabs from ie 7, I remember now.

    Neadless to go into another browser war, but check your facts before being smart :)


    — jinzo    Mar 11, 01:15 AM    #
  5. run firefox on solaris and use dtrace


    — mlh    Mar 11, 01:52 AM    #
  6. firefox should allow people to write in ruby instead of javascript.

    i have written in ruby since 5 years by now and its a lot better than javascript will ever become.


    — she    Mar 11, 02:19 AM    #
  7. Why? You know for sure it’s Flash that’s hogging CPU :)


    — kL    Mar 11, 02:46 AM    #
  8. Install noscript, and disable ALL scripting by default — only enable when needed for as long as needed.

    Still, a “what’s running where” capability would be nice too — along with some fine-grained control over the JS interpreter.


    — SJS    Mar 11, 02:50 AM    #
  9. Flashblock
    And possibly NoScript but the cause is rarely Javascript


    — EasyEasyAnswer    Mar 11, 03:04 AM    #
  10. Firebug has a JS profiler you could use. So does the Venkman JS debugger.

    You’re right, this would be a cool tool. There’s some students working on a “PluginWatcher” extension to monitor plugin activity.


    — Robert O'Callahan    Mar 11, 03:08 AM    #
  11. ok, you have 26 windows open with up to 30 tabs, and youre surprised your laptop has a tough time with that? It’s probably addressing its virtual memory, swapping data like crazy ;-)


    — fuffuf    Mar 11, 03:58 AM    #
  12. I agree, a process/memory monitor would be great. There have been many times that Firefox freezes up on me while using 95% to 100% of the CPU.


    Aaron Shaw    Mar 11, 05:04 AM    #
  13. It’s your platform that sucks. I use Firefox on Linux and with htop I can easily monitor each Firefox process (read tabs) in a convenient tree view and kill them independently.

    What’s really killing me in windows is the svchost process, now that’s stupid.

    @EasyAnswer

    It’s the other way around, Firefox leaks memory and get copied.


    h3    Mar 11, 06:28 AM    #
  14. There’s no process viewer in Firefox because the one person in the world who thinks there should be one is too busy blogging about it to build it.


    Giles Bowkett    Mar 11, 06:44 AM    #
  15. You can bookmark all tabs in a window and close it until, then the next window then the next, until you see your cpu get back to idle.
    Then you know which one was it.
    Then you can reopen the bookmarked tab groups in new windows.
    You can do the same for each tab in the window that causes the problem to find out which tab was it.

    Also, because javascript must run in single threaded mode and objects can reference DOM objects from other tabs/windows, all the javascript in the firefox process runs as a single thread, so they can’t really implement top easily.


    — Zeev    Mar 11, 07:40 AM    #
  16. EasyAnswer: I take offense of your remarks. Mozilla does NOT copy IE, only Opera (that’s the reason why Ff has become a great web navigator).


    — Roberto    Mar 11, 07:54 AM    #
  17. @EasyAnswer,

    I normally don’t engage in flamebaits, but I’d like to give just one counter-example to your statement: Firebug. Recently, I read an announcement somewhere that IE8 will include a tool similar to Firebug, so that means that Microsoft did in fact “steal” an original and great idea that a Firefox user had. Not that I have a problem with that, this competition will only increase the quality of both products making it better for the users of both products.


    JW    Mar 11, 07:58 AM    #
  18. Because the whole of Firefox is one giant Javascript loop?


    Mike Seth    Mar 11, 09:03 AM    #
  19. @KL, EasyEasyAnswer:

    I do run Flashblock, but I didn’t want to rule out some bit of flash I enabled running somewhere. I actually think it is way more likely that javascript is the culprit.

    @baczek:

    I’ve been running FF3 beta 3 and I notice that today beta 4 is out. The nightlies make me a bit nervous. We’ll see how beta 4 handles things (so far the betas have been much more memory conscious than FF2, but more prone to CPU spinning).

    @Zeev:

    That’s a good idea, but it seems a bit tedious. It may eventually come to that.

    @mlh:

    I don’t really have access to a Solaris machine. But I am running OS X to which dtrace was recently added. Does anyone know if OS X Firefox has dtrace hooks enabled?

    @fuffuf:

    I do expect it to behave nicely. When there’s no user input the only thing that should be happening is javascript timeouts and animated gif timeouts. Since I use adblock I generally don’t have any animated gifs sitting on pages. If a page has a timeout set and it’s doing a bunch of calculations constantly it’s really a badly designed page. I really think Firefox shouldn’t honor JS timeouts if the tab isn’t even visible.

    According to Activity Monitor it is taking 1.1 GB of virtual memory but only 450MB of that is in physical memory. There is no active swap thrashing going on. About once a second something goes and allocates 20MB of RAM and then frees it. But I have enough free RAM that it is not going to swap.

    @Robert O’Callahan:

    That’s good news. If it doesn’t do what I want it sounds like it could at least be a good piece of code to adapt. Hope it comes out soon…


    — David    Mar 11, 09:12 AM    #
  20. Any browser would choke on that many pages/windows open.


    — Dan    Mar 11, 12:50 PM    #
  21. @Dan:

    No! This sentiment seems to be shared by many people, but it’s just not true. Generally Firefox is perfectly fine with that many windows and tabs open. Which means generally pages are well behaved with regard to javascript.

    But sometimes it does what I described above and I wish I had a way to track down which page is the one with the problem.


    — David    Mar 11, 12:58 PM    #
  22. What you need to do is close about 21 of your windows and save yourself from getting an even weaker attention span.


    — Chris    Mar 11, 06:24 PM    #
  23. Just wanted to add a good word for NoScript. It solves all sorts of problems before they even start.


    Capt. Jean-Luc Pikachu    Mar 12, 06:03 AM    #
  24. firefox isn’t multithread you can’t have a process viewer because there is just one process.


    — Sebastian    Mar 13, 09:22 AM    #
  25. @Sebastian:

    It is multithreaded for all intents and purposes, just not with preemptive native OS/pthreads. It has green threads, like I said in the article.

    As long as FireFox knows which javascript function comes from what page (and they have to because of the “window” global variable) then they can keep track of which page is running what code and present me with a list of pages and % of time spent running scripts in them.


    — David    Mar 13, 10:09 AM    #
  Textile Help