shirou / gopsutil

psutil for golang
Other
10.56k stars 1.58k forks source link

Swap memory values for Mac #1237

Open ssdittak opened 2 years ago

ssdittak commented 2 years ago

https://github.com/shirou/gopsutil/blob/6918006d351cdca8e725243abf3e10a9968771ce/mem/mem.go#L81

I always get 0 values for Swap on Mac (even if I run as root) when I try to run open-telemetry collector which references gopsutil for paging related metrics: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others.go

Is this expected or am I missing something?

Lomanic commented 2 years ago

That depends, what's the result of sysctl vm.swapusage (see https://github.com/shirou/gopsutil/blob/6918006d351cdca8e725243abf3e10a9968771ce/mem/mem_darwin.go#L41)?

If your host is not under huge load, I guess it won't swap