Commit Graph

26 Commits

Author SHA1 Message Date
Steven Hartland f846eda923 Eliminate call to uname on FreeBSD
Improve performance by eliminating the fork out to uname on FreeBSD which also helps prevent crashes / hangs due to the outstanding fork crash bug:
golang/go#15658

Also added a test for PlatformInformation.
2018-03-11 23:08:04 +00:00
shirou 4c73494c78 Add WithContext functions. 2017-12-31 15:25:49 +09:00
Steven Hartland 6450c60b61 Eliminate use of sysctl command on FreeBSD
In order to improve performance and help prevent crashes due to the outstanding fork crash bug:
https://github.com/golang/go/issues/15658

Replace string parsed values from the sysctl command with native reads of sysctl values using unix.SysctlRaw and unix.SysctlUint32.

This also merges OpenBSD and FreeBSD load implementations which are identical.
2017-10-05 08:45:56 +01:00
WAKAYAMA Shirou 114c78c777 [host]: add not implemented methods. 2017-08-03 11:08:35 +09: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
tycho garen 22c56d292e close open files 2017-02-22 08:46:23 -05:00
Sean Chittenden 36f5033d97
Unconditionally lowercase the `HostID` from all supported platforms. 2017-02-06 16:10:46 -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
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
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
Shirou WAKAYAMA 57f6aebc7e add Timeout to invoke command and use common.Invoke refs: #201 2016-05-20 17:59:41 +09:00
WAKAYAMA shirou d9e994bec8 [host]freebsd: update freebsd_amd64 2016-04-23 23:10:23 +09:00
Shirou WAKAYAMA d21ed2b40d search path via exec.LookPath before actual invoke. 2016-04-01 22:13:05 +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
WAKAYAMA shirou 54a6c186c1 host[freebsd]: BREAKING CHANGE. Boottime() should return uint64 same as other. 2015-11-24 09:48:05 +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
Nick Galbreath 99d93f93b2 shirou/gopsutil#90 make hostinfo more robust 2015-10-13 13:02:02 -07:00
WAKAYAMA shirou abb4086531 host[freebsd]: change to use utmpx for 9.0 or later. 2015-08-15 01:20:56 +09:00
WAKAYAMA shirou b0c9f81246 host_freebsd now use godefs 2014-12-31 00:30:55 +09:00
Shirou WAKAYAMA 13cd195a7e change package name. 2014-12-30 22:09:05 +09:00
Shirou WAKAYAMA a4671fcc2a move subdirectories. refer to issue #24 2014-11-27 10:18:15 +09:00