github.com/tklauser/numcpus (go): Package numcpus provides information about the number of CPUs in the system.  It gets the number of CPUs (online, offline, present, possible or kernel maximum) on Linux, Darwin, FreeBSD, NetBSD, OpenBSD, DragonflyBSD, Solaris/Illumos or Windows systems.  On Linux, the information is retrieved by reading the corresponding CPU topology files in /sys/devices/system/cpu.  On BSD systems, the information is retrieved using the hw.ncpu and hw.ncpuonline sysctls, if supported.  On Windows systems, the information is retrieved using the GetActiveProcessorCount and GetMaximumProcessorCount functions, respectively.  Not all functions are supported on Darwin, FreeBSD, NetBSD, OpenBSD, DragonflyBSD, Solaris/Illumos and Windows. ErrNotSupported is returned in case a function is not supported on a particular platform.
Keywords: bsd|cpu|cputopology|go|golang|linux|numa|offline|online|unix