htop
htop copied to clipboard
How does htop get its stats?
I have ZFS on root on my system and htop is one of the few system monitoring tools that support ZFS so I'm trying to make one of my panel plugins display the same info htop does but using the "free" command doesn't add up to the same numbers.
More specifically I want to know how htop gets the used memory, free memory and cache.
The used memory + free memory + cache + used zfs arc should equal to the total memory, right?
I'm using this post from 2017 as reference but the math is off by 200 megabytes. The used memory I'm getting is a bit lower than what htop shows.