55 Commits (v4.24.12)

Author SHA1 Message Date
shirou 37f531010d fix golangcilint errors, ignore gosec G115
shirou.wakayama 0e9c0ade3c [host][windows]: change platform version from build version to display version
shirou ab0d977709 [sensors] move Temperatures from host to sensors.
shirou bc060cc227 add SPDX License, remove old build tag, and replace import
shirou b10acd4894 [host]: add EnableBootTimeCache function
Jeff Erbrecht a5ecb9bca5 [host] windows: use millisecond precision for BootTime()
Previously, system uptime is truncated to seconds, and then the
subtraction from `time.Now()` is performed. Because uptime does not roll
over to the next second at the same instant as `time.Now()`, then
`BootTime()` ends up not being precise, and often varies by 1 second.

This commit does the subtraction before truncating to seconds, which
results in a significantly lower chance of variance in `BootTime()`.
shirou 68452e2602 feat(host, windows): add UBR (Update Build Revision) to kernel version
mmorel-35 1e6b445a8a gofumpt
mmorel-35 eb5f6203d8 gofmt
shirou d2e27c1712 fix dependabot v2 deletion.
shirou 0969c9436b delete v2 directory, move v3 to top #1078
shirou 0fdf65fa3e Change to use yusufpapurcu/wmi from StackExchange/wmi.
Lars Meyer a7d936d0a4 [host][windows] Fix Windows 11 reporting
While ProductName remains "Windows 10", versions with Build no. >= 22000
are Windows 11.
Sergey Vinogradov 5209442b3c Refactor "host" package
Lomanic 8110480793 [host] Skip tests on non-implemented platforms #446
Lomanic 4bf185067d [host] Fix #737 add KernelArch field in InfoStat struct returning 'uname -m' result
Lomanic 98c779765f [host] go-fmt and propagate context on Windows in Info()
Lomanic bb518e9c4e [host][windows] Remove exported wmi type from #550
pytimer 62fcd00c4d [host] Implement windows temperature use wmi
Lomanic 6c4f577e6e
Merge branch 'master' into winapihost
Lomanic 61e2d92d95 [host][windows] Query registry via golang.org/x/sys/windows instead of golang.org/x/sys/windows/registry
See https://github.com/shirou/gopsutil/pull/312#issuecomment-277422612
Lomanic d8a6a50129 Revert "[host][windows] Refactor code to query registry via golang.org/x/sys/windows/registry"
This reverts commit c729bbd6a8.
Lomanic c729bbd6a8 [host][windows] Refactor code to query registry via golang.org/x/sys/windows/registry
Lomanic eb11fd6e2f [host][windows] Completely remove slow wmi calls to retrieve OS version, use registry and RtlGetVersion
Lomanic df331c7615 [host][windows] Use win32 API to get host's uptime instead of (slow) wmi
sada 8dd42707e2 windows: fix WithContext functions
set timeout only if parent context doesn't set.
shirou 4c73494c78 Add WithContext functions.
leaf 65598d98cc To prevent hang if wmi.Query hangs, add a context-aware wrapper for it.
WAKAYAMA Shirou 114c78c777 [host]: add not implemented methods.
WAKAYAMA Shirou 9c5b318e0d [host] windows: define Virtualization()
Sean Chittenden 635b971c0e
Move from the `syscall` package to the `golang.org/x/sys/{unix,windows}`
Frank Schroeder a9e803ef6a
Fix data race in host.BootTime
WAKAYAMA Shirou dfbb3e40da fix build bugs.
Eric Gourlaouen 8b08ca5fdc added temperatures
Alexey Galkin b1f19a76c7 Fix for getMachineGuid() return value
getMachineGuid() function return a empty value in x86 windows builds.
Issue: https://github.com/shirou/gopsutil/issues/322
Sean Chittenden 36f5033d97
Unconditionally lowercase the `HostID` from all supported platforms.
Sean Chittenden 650c4d595f
Use `HKLM/SOFTWARE\Microsoft\Cryptography`'s `MachineGuid` registry key to enable `HostID` support on Windows.
Conor Branagan 5afd6f21c9 Cache the boot time after first query.
When fetching stats on all processes at once there's a non-trivial amount of
time spent in the `BootTime` call. But since this value should never change
during a live process, we can use a cached version for all subsequent calls.
Sean Chittenden fcd296ea11
Merge branch 'master' of github.com:shirou/gopsutil
Sean Chittenden 69f7f8eaeb
Update host.Info() to return the number of processes on all platforms.
Fixes: #227
WAKAYAMA Shirou 53406b2832 [host]Windows: BootTime and Uptime are reversed on Windows.
Shirou WAKAYAMA ea152ea901 [BREAKING CHANGE] rename functions to pass golint. ex) net.NetIOCounters -> net.IOCounters
Cameron Sparr 444ee723c3 Fix HostInfo.Uptime, which has been returning boot time
Also adding a HostInfo.BootTime field for holding the boot time
Shirou WAKAYAMA 7288e9a5af common[all]: add internal
Jonathan Chauncey 0461c50666 chore(*): Fixes #94
Added the ability to fetch an alternative location for /proc via an
environment variable. If the env var is not set it will return /proc as
the default value.
Nick Galbreath 99d93f93b2 shirou/gopsutil#90 make hostinfo more robust
mayowa bf16d0a6a7 modified PlatformVersion and PlatformFamily string to (somewhat) match the output from sysinfo
mayowa ee43e655c2 implemented GetPlatformInfo and refactored HostInfo() to use it
mayowa 56d70ecc5e implemented HostStatInfo.Platform* for windows
WAKAYAMA shirou 64357f04e7 use StackExchange/wmi instead of invoking wmic process.
Note: This may not work on some old Windows XP.