7

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.

AlanQ
  • 71
  • Check this https://askubuntu.com/questions/1220827/what-is-the-way-to-determine-which-tab-in-firefox-is-using-100-of-one-of-my-cpu – Z0OM Mar 08 '22 at 18:04
  • And this https://unix.stackexchange.com/questions/484388/monitoring-cpu-of-tabs-in-firefox – Z0OM Mar 08 '22 at 18:06
  • And this https://unix.stackexchange.com/questions/78689/fix-firefox-is-already-running-issue-in-linux – Z0OM Mar 08 '22 at 18:09
  • Check this command "pidof firefox" or "pidof firefox-esr" in bash – Z0OM Mar 08 '22 at 18:09
  • 1
    @MarcusMüller They're not asking for that — it's just a statement that something similar is already possible. Sounds like a sensible introduction. In context, "equivalent information" then becomes "which tab is hogging the bandwidth". – Andreas Mar 08 '22 at 21:57
  • 1
    @Andreas ah, thanks! deleted my comment. – Marcus Müller Mar 08 '22 at 21:58

2 Answers2

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.

Stephen Kitt
  • 434,908
  • 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 '22 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

Z0OM
  • 3,149
  • 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. – Vilinkameni Mar 09 '22 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 '22 at 07: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 []. – Vilinkameni Mar 10 '22 at 07:21