Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grofer not supported on MacOS and Windows #14

Open
metonymic-smokey opened this issue Aug 4, 2020 · 5 comments
Open

Grofer not supported on MacOS and Windows #14

metonymic-smokey opened this issue Aug 4, 2020 · 5 comments
Labels
bug Something isn't working priority: high

Comments

@metonymic-smokey
Copy link
Collaborator

metonymic-smokey commented Aug 4, 2020

Describe the bug
The individual process stats feature of grofer does not work on MacOS.

To Reproduce
Steps to reproduce the behaviour:
Run ./grofer proc -p <pid> as usual on a system running MacOS/Windows.

Expected Behaviour
Grofer should display process stats for the given PID like in Linux.

Actual Behaviour
On MacOS:
A runtime error with a segmentation violation.
The prompt in Terminal also does not function as usual after this,

Desktop (please complete the following information):

  • MacOS/Windows
  • Go Version 1.14
@metonymic-smokey metonymic-smokey added bug Something isn't working priority: high labels Aug 4, 2020
@MadhavJivrajani
Copy link
Member

For windows, this link might be useful: https://godoc.org/github.com/shirou/gopsutil/winservices

@AbhilashBalaji
Copy link

AbhilashBalaji commented Aug 30, 2020

For MacOS , it seems that gopsutil doesn't support a number of data points from the kernel , for example num_ctx_switches and exe process classes (reference).used here , from my preliminary googling darwin support for ps type external libraries is a little sketchy . Do let me know if there are libraries that do pull this off but until then support for Macos seems limited.

@MadhavJivrajani
Copy link
Member

MadhavJivrajani commented Aug 30, 2020

Interesting, that explains why grofer crashes. One workaround that I can think of is utilizing the information that gopsutil provides and for parameters like num_ctx_switches, parse the output of an external command similarly to how its done for grofer --cpuinfo.

One command that I came across for getting the enumber of context switch information would be latency although I am not sure if its an inbuilt command or a dependency. The finer details of the stats provided might also be of concern such as if its possible for it to provide separate numbers for voluntary and involuntary switches, etc.

Since you're using MacOS, maybe you could try out a few of these commands and we could proceed accordingly!

@MadhavJivrajani
Copy link
Member

Okay this is interesting,
Turns out that commands like ps are implemented in a different way on MacOSX since it does not have a /proc fs. Info is gathered by ps using the sysctl and kvm commands. sysctl seems to provide quite a lot of information that we could work with!

@AbhilashBalaji
Copy link

I'll try writting a cgo library by referencing an outdated project like go-ps and get some OSX compatibility soon

@Gituser143 Gituser143 added the hacktoberfest Issues for Hacktoberfest 2021 label Sep 30, 2021
@Gituser143 Gituser143 removed the hacktoberfest Issues for Hacktoberfest 2021 label Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: high
Projects
None yet
Development

No branches or pull requests

4 participants