Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Tying PID to specific chrome instance? [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Tue Jan 22, 2019 11:48 am    Post subject: Tying PID to specific chrome instance? [SOLVED] Reply with quote

I run a lot of open chrome windows across multiple desktops. Occasionally, I'll see one or two instances of chrome running a higher than expected CPU%. I'm looking for a non-destructive way to start with the problem PID and understand which open chrome window contains the problem.

I assume I'll need to either run as root or use sudo to do this. Since this is my personal machine, $DEITY access is not an issue.

I'd like to know which desktop the culprit is on and some relatively unique information which will help me identify the open window. Such information could be the site domain name.

Ideally, a utility which would accept a PID and then set the associated window frame or window header to flashing would be ideal.

For those interested, over active chrome instances usually seem to fall into several categories.
  1. Run away process.
  2. Malicious - in the sense that said site continuously runs too much crap. 3rd party advertising is especially guilty.
  3. Broken - this includes instances of google's gmail client sometimes breaking.

My current procedure is open an instance of 'top' set to all desktops, visually inspect each chrome window, kill suspect windows (one at a time) and watch 'top' to see if the problem PID goes away.

This really isn't how I want to do this

Normally, a chrome runaway is signified by running 100% on a single CPU core. Several open windows may exhibit funky graphical interaction. This usually takes the form that the window appears unresponsive but graphically updates as soon as you click anywhere else.

The other two categories require observation to get to the root of the probable cause (3rd party issues, borked site originating process). Of course, killing the suspect window halts observation.

Experience has shown me that static sites (such as leaving a window open on gentoo forums or wiki should be only 0.2%. Sites which periodically update runners should be no more than 5% (but typically less than 3%). Anything more should be investigated.

Is there a good way starting with a PID to find it's associated X window?

Are than any tools at all aimed at regular users rather than developers?

I forgot! To get a sense of the scale of the problem, this i what my 'pidof chrome' usually looks like:
Code:
# pidof chrome
30397 30324 30046 27342 27141 27122 27111 24664 24281 24260 24233 24121 24092 24026 23900 23495 23450 23372 23270 22492 22491 22461 22342 22312 22278 22277 22259 22192 22179 22154 22133 22066 22053 22039 22016 21999 21980 21972 21893 21881 21869 21857 21846 21833 21821 21809 21797 21785 21771 21762 21747 21739 21728 21717 21505 21463 21436 21431 21422 14069 14049 14023 13999 13976 13864 13827 13805 13551 13544 13500 13492 13480 13431 13406 13361 13347 13299 13269 13255 13241 13226 13206 13181 13095 13020 13006 12989 12967 12955 12930 12901 12880 12868 12779 12778 12745 12732 12714 12679 12672 12671 12608 12597 12586 12574 12563 12551 12536 12382 12313 12261 12233 12224 12215 10331 5536 5509 5491 5342 5305 5270 5224 5189 5158 4926 4915 4886 4833 4809 4663 4588 4488 4472


I want to go from a specific PID to it's associated X window.
_________________
People whom think M$ is mediocre, don't know the half of it.


Last edited by dufeu on Tue Jan 22, 2019 2:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 21334
Location: here

PostPosted: Tue Jan 22, 2019 12:55 pm    Post subject: Reply with quote

Type Shift+Esc in chromium
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Tue Jan 22, 2019 2:12 pm    Post subject: Reply with quote

fedeliallalinea wrote:
Type Shift+Esc in chromium

Oooooohh! Nifty!!

Nifty and useful even. ;)

This gives me something to crosscheck against and determine the exact tab which is consuming too much CPU. For that, it's perfect and allows me to do exactly what I need to do. Real life example to follow.

This is my new procedure for finding problem chrome children:
  1. Open a terminal and run 'top'
    Code:
    top -i -d10

  2. Set the 'V' command in top. This will give a display like:
    Code:
    21422 guynonet  20   0 2704052 931872 394516 S   9.7   3.0 303:07.70      `- chrome
    21728 guynonet  20   0  763916 132264  37860 S   0.6   0.4  15:06.74                  `- chrome
    21771 guynonet  20   0  735612 102352  31944 S   0.6   0.3  14:33.27                  `- chrome
    21785 guynonet  20   0  735760 107696  30628 S   0.6   0.3  15:08.81                  `- chrome
    21797 guynonet  20   0  752576 136444  56744 S   0.1   0.4   1:13.06                  `- chrome
    21809 guynonet  20   0  712860 134080  34124 S   0.1   0.4   1:42.70                  `- chrome
    21846 guynonet  20   0  635120  86640  37860 S   1.0   0.3  24:08.67                  `- chrome
    21893 guynonet  20   0  742028 135136  45584 S   2.6   0.4  55:59.42                  `- chrome
    22016 guynonet  20   0  643460  92028  28156 S   0.4   0.3   6:11.63                  `- chrome
    22053 guynonet  20   0  977292 328188  77508 S   8.4   1.1 197:41.31                  `- chrome
    22066 guynonet  20   0  635804 100304  25256 S   0.6   0.3  14:30.56                  `- chrome
    22133 guynonet  20   0  726944 177912  57104 S   0.1   0.6   0:45.93                  `- chrome
    22154 guynonet  20   0  689680  74748  30092 S   6.3   0.2  60:03.47                  `- chrome
    22192 guynonet  20   0  578332  65568  40292 S   0.1   0.2   0:43.98                  `- chrome
    23270 guynonet  20   0  678912 117052  60940 S   1.1   0.4  10:30.50                  `- chrome
    23495 guynonet  20   0  969328 355172 282328 S   1.4   1.2 283:55.97                  `- chrome
    13255 guynonet  20   0  637636 132804  72548 S   0.1   0.4   0:17.71                  `- chrome
    13269 guynonet  20   0  651484 143368  75104 S   0.7   0.5   1:26.71                  `- chrome
    13299 guynonet  20   0  674660 156460  74316 S   0.5   0.5   1:30.28                  `- chrome
    13544 guynonet  20   0  646804 129688  81456 S   0.2   0.4   0:23.84                  `- chrome
    30397 guynonet  20   0  646608 136448  73972 S   0.8   0.4   8:38.38                  `- chrome

  3. Click on any open chrome window and hit 'Shift+Esc (GREAT suggestion!). In the sub window that pops up, set to sort by the Process ID.
Now I can cross reference problem PIDs with their associated chrome tabs.

PIDs 22053 and 23495 are the obvious bad boys here. Inspection of their respective tabs revealed that 22053 was a visually hidden link to doubleclick.net. I see this often when a 3rd party has a broken API that doesn't terminate progerly. In this case, the adserver appears to have screwed up. The tab 23495 has no ads and none of the other tabs open to this site was misbehaving.. This one appeared to be a site resource query screw up. Now I know what I can safely kill.
_________________
People whom think M$ is mediocre, don't know the half of it.
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 21334
Location: here

PostPosted: Tue Jan 22, 2019 2:29 pm    Post subject: Reply with quote

You have CPU and memory usage directly in chromium tasks manager
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 896
Location: US-FL-EST

PostPosted: Wed Feb 20, 2019 5:57 pm    Post subject: Reply with quote

fedeliallalinea wrote:
You have CPU and memory usage directly in chromium tasks manager

This is true but there are several problems with viewing CPU and memory usage using the chromium tasks manager.

The chromium task manager defaults to viewing tasks by task name. If you want to view the tasks by-descending CPU usage or by-descending memory usage, then the view isn't very useful. One reason for this is that the chromium task manager has a set rather short refresh interval that you cannot change. When viewing by-descending CPU/memory, this means the various tasks end up jumping around in display order as their respective CPU/memory usage changes.

Since the goal is to determine which tasks(tabs) contain high CPU/memory usage elements, viewing by-descending order is a requirement.
_________________
People whom think M$ is mediocre, don't know the half of it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum