6

top not only shows 'firefox' but also its individual tabs, each identified as 'Isolated Web Co'.
So it is possible to find which tab is hogging the processor and kill it with kill <PID>.

Is there a network monitoring tool that gives the equivalent information?

nethogs only shows 'firefox', but doesn't break it down by tab.


Edit:
Even if Firefox added this info to about:networking, killing a tab can be more useful than closing: a closed tab is 'gone' (except 'Reopen Closed Tab', or via history), but a killed tab remains in place and can be recovered with F5 or <ctrl>r.

6

2 Answers 2

6

This isn’t the goal of your question, but it could be useful to some: in Firefox, about:performance (enter that in the URL bar) will show you how much memory each tab is using, and give an idea of each tab’s performance impact (“energy impact”). You can close tabs from this view to get rid of the performance hogs.

Firefox doesn’t include per-tab network monitoring, outside of the developer tools; you can see how much data is transferred between your computer and individual remote hosts in about:networking#sockets. Using the developer tools, you can open a network tracer (CtrlShiftE) which will show the network activity of the current tab.

As far as I can tell, it wouldn’t be possible for external monitoring tools to assign network activity to a specific tab in Firefox, because the sockets used by the various tabs are shared by all the threads in a given Firefox process. So even if a tool such as nethogs were changed to track network usage by thread, it wouldn’t show any useful information with a finer granularity than it does today.

1
  • Thank you, Stephen, lots of useful info there. From your final paragraph it would seem that per tab network usage could be provided only by the browser. It's frustrating that about:networking shows so much info but not per tab.
    – AlanQ
    Mar 11, 2022 at 13:49
1

UPDATE The seems to be working for the usage in bash:

watch -n 1 "ps aux | grep [f]irefox"

watch -n 0.1 "ps aux | grep [f]irefox"

watch -n 1 "ps aux | grep [f]irefox && free -m"

watch -n 0.1 "ps aux | grep /usr/lib/firefox-esr/firefox"

watch -n 0.1 "ps aux | grep /usr/lib/firefox-esr/firefox && free -m"

watch -d -n 0.1 "ps aux | grep [f]irefox"

Load a page and press F5 in the tab(again and again or hold the F5 button pressed) and watch

When i kill the a tab with the right pid i get the message in the tab, that the tab is crashed now ^^

In Firefox, about:performance is right.

But check also this in bash if i close or open and load a page tab:

$ pidof firefox

$ pidof firefox-esr

$ pgrep firefox get the main/parentid of one or "n" profiles

$ pgrep firefox-esr get the main/parentid of one or "n" profiles

Get parentid and childid

$ ps aux | grep [f]irefox

$ ps aux | grep [f]irefox | grep tab

You see the parentBuildID and something of the child/tab

It looks like that you can't close the child/tab only the parentBuildID, if you kill the child/tab the tab will crash but not close(but killed).

ps -ef | grep [f]irefox | wc -l

ps -ef | grep [f]irefox | grep tab | wc -l

3
  • 1
    [] around the "f" in [f]irefox is unnecessary. You probably meant [Ff]irefox. You can also use grep -i firefox to account for all case variants. Mar 9, 2022 at 20:16
  • 2
    With [f] i don't get the last line with the grep command it self in the output right? @Vilinkameni diff: beetwen "ps aux | grep firefox" and "ps aux | grep [f]irefox" is the last output line.
    – Z0OM
    Mar 10, 2022 at 7:08
  • It's a hack, I admit I didn't know about it. Instead, I know about the idiomatic | grep -v grep. When I think about it, how it works is that the command grep [f]irefox won't get matched because of the characters [ and ] in the second argument, and the pattern happens to match firefox, without the []. Mar 10, 2022 at 7:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .