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

21 Commits

Author SHA1 Message Date
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
Josh Powers
e7c6b6991d
fix: moves common.Warnings to common OS files
This allows all OS types to unwrap the Warnings from errors, and not
just linux in host or windows in disk.

fixes: #1429
2023-03-15 06:39:08 -06: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
Matthieu MOREL
b673968d5d
enable errorlint linter 2021-12-04 22:29:38 +01:00
shirou
0969c9436b delete v2 directory, move v3 to top #1078 2021-11-30 23:47:59 +00:00
Sergey Vinogradov
5209442b3c Refactor "host" package 2020-09-11 18:54:53 +03:00
Lomanic
4bf185067d [host] Fix #737 add KernelArch field in InfoStat struct returning 'uname -m' result 2019-08-08 23:11:41 +02:00
Laurie Clark-Michalek
413cb32b6c Use static initialisation for invoke instances, instead of init funcs
The order of init function execution is dependant on the order that the
source files are passed to the compiler. This causes issues when
building under other build systems, such as bazel or buck, as they are
not guarenteed to maintain the same file order as the default go tool.
2018-03-21 14:08:39 +00:00
Frank Schroeder
a9e803ef6a
Fix data race in host.BootTime 2017-06-01 18:11:14 +02:00
Eric Gourlaouen
8b08ca5fdc added temperatures 2017-03-19 02:08:19 +01: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
Lukas Fittl
13aedadcde Add separate kernelVersion field to host information.
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.
2016-08-22 14:15:30 -07:00
Sean Chittenden
59094cd5b7
Add HostID to the Host InfoStat struct returned from host.Info().
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.
2016-08-11 00:51:07 -07:00
Shirou WAKAYAMA
57f6aebc7e add Timeout to invoke command and use common.Invoke refs: #201 2016-05-20 17:59:41 +09:00
Shirou WAKAYAMA
4bb84648bf JSON representation is renamed to fit Google JSON style, camelCase. 2016-03-23 10:52:46 +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
13cd195a7e change package name. 2014-12-30 22:09:05 +09:00
Shirou WAKAYAMA
16de570414 merge 039b9defabe2fba35c9d3a4dbf7edc3fad812227 2014-12-27 23:42:00 +09:00
Shirou WAKAYAMA
a4671fcc2a move subdirectories. refer to issue #24 2014-11-27 10:18:15 +09:00