1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-26 13:48:59 +08:00

55 Commits

Author SHA1 Message Date
shirou
37f531010d fix golangcilint errors, ignore gosec G115 2024-08-23 08:22:42 +00:00
shirou.wakayama
0e9c0ade3c [host][windows]: change platform version from build version to display version 2024-05-28 22:27:17 +09:00
shirou
ab0d977709 [sensors] move Temperatures from host to sensors. 2024-05-28 22:27:17 +09:00
shirou
bc060cc227 add SPDX License, remove old build tag, and replace import 2024-05-28 22:27:17 +09:00
shirou
b10acd4894 [host]: add EnableBootTimeCache function 2024-01-11 00:49:11 +09:00
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()`.
2023-01-04 10:42:00 -05:00
shirou
68452e2602 feat(host, windows): add UBR (Update Build Revision) to kernel version 2022-11-05 20:59:15 +09:00
mmorel-35
1e6b445a8a gofumpt 2021-12-22 21:54:41 +00:00
mmorel-35
eb5f6203d8 gofmt 2021-12-22 21:46:33 +00:00
shirou
d2e27c1712 fix dependabot v2 deletion. 2021-12-01 00:12:55 +00:00
shirou
0969c9436b delete v2 directory, move v3 to top #1078 2021-11-30 23:47:59 +00:00
shirou
0fdf65fa3e Change to use yusufpapurcu/wmi from StackExchange/wmi. 2021-11-20 11:36:30 +00:00
Lars Meyer
a7d936d0a4 [host][windows] Fix Windows 11 reporting
While ProductName remains "Windows 10", versions with Build no. >= 22000
are Windows 11.
2021-10-08 09:36:28 +02:00
Sergey Vinogradov
5209442b3c Refactor "host" package 2020-09-11 18:54:53 +03:00
Lomanic
8110480793 [host] Skip tests on non-implemented platforms #446 2020-08-29 18:39:44 +02:00
Lomanic
4bf185067d [host] Fix #737 add KernelArch field in InfoStat struct returning 'uname -m' result 2019-08-08 23:11:41 +02:00
Lomanic
98c779765f [host] go-fmt and propagate context on Windows in Info() 2019-08-07 22:34:36 +02:00
Lomanic
bb518e9c4e [host][windows] Remove exported wmi type from #550 2018-07-14 18:52:10 +02:00
pytimer
62fcd00c4d [host] Implement windows temperature use wmi 2018-07-09 15:21:26 +08:00
Lomanic
6c4f577e6e
Merge branch 'master' into winapihost 2018-06-23 16:44:14 +02:00
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
2018-06-18 23:03:56 +02:00
Lomanic
d8a6a50129 Revert "[host][windows] Refactor code to query registry via golang.org/x/sys/windows/registry"
This reverts commit c729bbd6a8e6fd243e2f43c24666c29feb3e6294.
2018-06-18 22:17:31 +02:00
Lomanic
c729bbd6a8 [host][windows] Refactor code to query registry via golang.org/x/sys/windows/registry 2018-06-17 23:48:45 +02:00
Lomanic
eb11fd6e2f [host][windows] Completely remove slow wmi calls to retrieve OS version, use registry and RtlGetVersion 2018-06-17 23:41:32 +02:00
Lomanic
df331c7615 [host][windows] Use win32 API to get host's uptime instead of (slow) wmi 2018-06-10 18:30:22 +02:00
sada
8dd42707e2 windows: fix WithContext functions
set timeout only if parent context doesn't set.
2018-02-12 13:26:17 -08:00
shirou
4c73494c78 Add WithContext functions. 2017-12-31 15:25:49 +09:00
leaf
65598d98cc To prevent hang if wmi.Query hangs, add a context-aware wrapper for it. 2017-11-20 10:13:27 -08:00
WAKAYAMA Shirou
114c78c777 [host]: add not implemented methods. 2017-08-03 11:08:35 +09:00
WAKAYAMA Shirou
9c5b318e0d [host] windows: define Virtualization() 2017-08-03 10:14:20 +09:00
Sean Chittenden
635b971c0e
Move from the syscall package to the golang.org/x/sys/{unix,windows} 2017-06-02 13:51:00 -07:00
Frank Schroeder
a9e803ef6a
Fix data race in host.BootTime 2017-06-01 18:11:14 +02:00
WAKAYAMA Shirou
dfbb3e40da fix build bugs. 2017-04-10 22:24:36 +09:00
Eric Gourlaouen
8b08ca5fdc added temperatures 2017-03-19 02:08:19 +01:00
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
2017-03-03 16:30:53 +04:00
Sean Chittenden
36f5033d97
Unconditionally lowercase the HostID from all supported platforms. 2017-02-06 16:10:46 -08:00
Sean Chittenden
650c4d595f
Use HKLM/SOFTWARE\Microsoft\Cryptography's MachineGuid registry key to enable HostID support on Windows. 2017-02-02 16:08:58 -08:00
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.
2016-10-13 11:24:29 -04:00
Sean Chittenden
fcd296ea11
Merge branch 'master' of github.com:shirou/gopsutil 2016-07-11 01:15:11 -05:00
Sean Chittenden
69f7f8eaeb
Update host.Info() to return the number of processes on all platforms.
Fixes: #227
2016-07-10 23:47:29 -05:00
WAKAYAMA Shirou
53406b2832 [host]Windows: BootTime and Uptime are reversed on Windows. 2016-06-12 23:20:51 +09:00
Shirou WAKAYAMA
ea152ea901 [BREAKING CHANGE] rename functions to pass golint. ex) net.NetIOCounters -> net.IOCounters 2016-03-22 23:09:12 +09:00
Cameron Sparr
444ee723c3 Fix HostInfo.Uptime, which has been returning boot time
Also adding a HostInfo.BootTime field for holding the boot time
2015-11-23 13:18:59 -07:00
Shirou WAKAYAMA
7288e9a5af common[all]: add internal 2015-10-20 00:04:57 +09:00
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.
2015-10-17 11:34:41 -06:00
Nick Galbreath
99d93f93b2 shirou/gopsutil#90 make hostinfo more robust 2015-10-13 13:02:02 -07:00
mayowa
bf16d0a6a7 modified PlatformVersion and PlatformFamily string to (somewhat) match the output from sysinfo 2015-08-28 07:39:20 +01:00
mayowa
ee43e655c2 implemented GetPlatformInfo and refactored HostInfo() to use it 2015-08-25 23:27:25 -07:00
mayowa
56d70ecc5e implemented HostStatInfo.Platform* for windows 2015-08-25 23:03:25 -07:00
WAKAYAMA shirou
64357f04e7 use StackExchange/wmi instead of invoking wmic process.
Note: This may not work on some old Windows XP.
2015-04-20 00:05:31 +09:00