Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

issues with showing chrome processes #107

Closed
rareinator opened this issue Feb 8, 2019 · 3 comments
Closed

issues with showing chrome processes #107

rareinator opened this issue Feb 8, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@rareinator
Copy link

rareinator commented Feb 8, 2019

Required information:

  • gotop version (gotop -v): 2.0.1
  • The output of uname -a: Darwin Mortens-MacBook-Pro.local 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64
  • Terminal shell (e.g. zsh or bash): zsh
  • Terminal emulator (e.g. iTerm or gnome terminal): iTerm
  • Any relevenat hardware info: dont really think so
  • tmux version if using tmux: no

Also please copy or attach the following file if it exists and contains logs:
errors.log

So yeah for some reason I cant see any of the chrome processes, that are currently running. Even though both htop and top can see them.

@cjbassi
Copy link
Owner

cjbassi commented Feb 9, 2019

So the issue is that we use ps to get the list of processes, and unfortunately it's difficult to process its output since the columns of information are ill-defined. On Linux, you can specify column width, but you can't on OSX so we currently split on whitespace, but some command names have spaces in their names which causes this bug.

Some ideas we can try:

  • double check the man page and see if there's any way to format the columns to make it easier to parse
  • see if there's a way for ps to not include whitespace in command names
  • create a regex to match the process name by matching any characters between the PID column and CPU and MEM columns

@cjbassi cjbassi added the bug Something isn't working label Feb 9, 2019
@rareinator
Copy link
Author

rareinator commented Feb 9, 2019

well I know there is the -o format that can be used to specify custom formatting could try taking a look into that.

nvm, also doesn't work properly on OSX, as you said you cant specify the column width. Will try digging a little deeper to see if I can find a way.

@whuang8
Copy link
Contributor

whuang8 commented Feb 9, 2019

👋 all. I think another solution can be to make use of the headers. Instead of removing the headers, we can use strings.Index to find the indexes of the following substringsPID COMM CPU MEM ARGS in the headers row. Then, we can just use those indexes to access the correct information in the subsequent rows.

If strings.Index(headers, "COMM") returns 4 and strings.Index(headers, "CPU") returns 24, we can determine that the command name is defined in the substring from index 4 to index 24.

What do you folks think?

[EDIT] There is also another way using the -o flag on macOS

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants