The value for `ClockTicks` is defined as `100` by the Linux kernel for
all currently supported architectures in Go. Therefore, there is no need
to define this constant for each architecture separately.
This fixes#260.
Signed-off-by: Thomas Hipp <thomashipp@gmail.com>
* on virtualized host, this may happen.
* but we may have a value from parsing `/proc/cpuinfo`
* in this case, we do not return the error if we fail to extra
a value from `cpufreq/cpuinfo_max_freq`
* resolve#249
* in `cpu_windows.go`, `Mhz` is the value of `MaxClockSpeed`
* on Linux platform, the `Mhz` value is extracted from `/proc/cpuinfo`
which reflects the current clock speed; treat this as the fallback
value instead
* read from `cpufreq/cpuinfo_max_freq` under sysfs to get the
maximum clock speed for `Mhz`, just like for Windows platform
* also fix the path to `cpu.CoreID` value; the filename is `core_id`
* for Darwin, it is a minor tweak for readability: the value
returned is in Hz, so using a variable named 'hz' makes more
sense than 'mhz'
* for Linux, the unit is in kHz so we need to divide the value
from `cpuinfo_max_freq` by 10^3 to get MHz (see
cpu-freq/user-guide.txt of the kernel documentation)
This enables using gopsutil in a codebase that gets built on other OSes
than the ones supported. Instead of a build failure as before, due to
the build tags, gopsutil will now throw an "not implemented" runtime
error.
Fixes#234.
This is mostly intended for Linux, where we are returning the OS version
in the PlatformVersion field, which seems reasonable. Often it is still
useful to know which Linux kernel is running.
For FreeBSD and Darwin the kernel version matches the platform version,
since they previously used the kernel version for the platform version.
For Windows the kernel version is empty, since there is no clear way
to determine it.
before falling back to kernel.random.boot_id.
`/sys/class/dmi/id/product_uuid` is still managed by permissions, so
for root-run processes where `/sys/class/dmi/id/product_uuid` is
available, the host's UUID will be used instead, otherwise the UUID
from kernel.random.boot_id will be used instead.
On supported hosts the value returned is a UUID (case preserving
from the value of the underlying OS).
For Linux this is generated once, randomly per boot. For FreeBSD and
Darwin this is a more durable value that should persist across reboots.