cjbassi / gotop

A terminal based graphical activity monitor inspired by gtop and vtop
GNU Affero General Public License v3.0
7.36k stars 437 forks source link

OpenBSD support #112

Closed omar-polo closed 5 years ago

omar-polo commented 5 years ago

Hi!

This adds openbsd to proc_other build tags (needed to build gotop and to get the list of processes) and implements update for Temp (loosely based on sysctl(8) code). With these changes gotop builds and runs on OpenBSD-CURRENT on amd64.

The disk, memory and network usage widgets worked OOTB, while the cpu usage displays wrong percentages (almost always 100% on all CPUs). Battery also doesn't seem to work, but I'll look into that.

It's the first time I write go code, I hope it doesn't suck too much.

Demonstrative screenshot: 2019-02-18-113045_1105x667_scrot

omar-polo commented 5 years ago

just checked: the problem I have with the battery is distatus/battery fault. It doesn't recognize the battery on my system for some reason. I'm trying to understand why that code fails, but that it's outside the scope of this pull request.

The CPU problem is similar but weirder: gotop displays all CPUs at 100% while shirou/gopsutil/cpu report every CPU at 0%. I still have to figure it out why.

pikadirr commented 5 years ago

Hi Omar, I don't get why you are asking me because I know nothing about cars.. :/

cjbassi commented 5 years ago

Thanks for working on this and glad you were able to mostly get it working so far. The code looks good, I pushed one commit to your fork to fix a couple minor things. The CPU issue seems strange since we're pretty much just appending the results from gopsutil to an array and drawing those. As far as the battery goes, some other people were having issues too, maybe these might help: https://github.com/cjbassi/gotop/issues/100, https://github.com/distatus/battery/issues/8 But the battery is less of a priority like you said.

cjbassi commented 5 years ago

If we can get the CPUs working, then we can merge this and open an issue for the batteries. It would also be good to determine if the battery issue you're getting is the same as the issue described in those 2 links.

omar-polo commented 5 years ago

Hi, thanks for the fix, the code looks better now.

Forget what I said about the 0% on all CPUs, I made an error in a script to test shirou/gopsutil/cpu. But the fact that the percentage reported aren't right still remains. I'm gonna test it a couple of days on a machine with OpenBSD 6.4-STABLE to check if it's a recent change in the OS that breaks gopsutil, and then report to shirou.

For the battery: at first sight it doesn't seem the same issue: the battery scripts from distatus/battery outputs "No batteries" on my system. I'll look into it during the next week.

cjbassi commented 5 years ago

Sounds good. I guess we can merge this then since the rest of the issues are external. I created #117 and #118 to track the 2 issues, so feel free to report on any findings there.