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

1595 Commits

Author SHA1 Message Date
Lomanic
42136c7364
Merge pull request #947 from Lomanic/issue925
[process][darwin] Fix #925 properly and improve some tests
2020-10-02 18:28:51 +02:00
Lomanic
eaa34817d0 [process] Add benchmarks for New(), Name() Ppid()
run only them with: go test -bench=. -run=xxx github.com/shirou/gopsutil/process
2020-10-01 10:24:54 +02:00
shirou
5084874a4c
Merge pull request #942 from AtakanColak/patch-1
Cache common/common_linux.Virtualization()
v2.20.9
2020-10-01 11:56:51 +09:00
Lomanic
64ba9d03cd [process] Properly test Ppid() against known value 2020-09-29 23:58:34 +02:00
Lomanic
c9c40215f5 [process][darwin] Fix #925 properly with unix.SysctlRaw("kern.proc.pid", PID) 2020-09-29 23:56:25 +02:00
Ata
ba243b1d14
removed explicit set to nil 2020-09-29 10:12:48 +03:00
Lomanic
8ece829fb7
Merge pull request #945 from shirou/host_linux_change_to_use_sysinfo_to_get_uptime
[host][linux] Change to use unix.SysInfo_t to get Uptime in Linux
2020-09-28 19:47:15 +02:00
shirou
6c9f3bdcae [host][linux] Change to use unix.SysInfo_t to get Uptime in Linux 2020-09-19 11:12:05 +09:00
shirou
c5b7357407
Merge pull request #944 from shirou/issue849
[cpu][linux] Fix #849 implement giampaolo/psutil#1727 and test Counts against lscpu
2020-09-19 10:24:54 +09:00
Lomanic
bb6f6e4968 [cpu][linux] Test Counts against lscpu results 2020-09-15 21:39:25 +02:00
Lomanic
7700262175 [cpu][linux] Fix #849 implement giampaolo/psutil#1727 in Counts() for physical cores 2020-09-15 21:38:47 +02:00
Lomanic
4545a21761
Merge pull request #939 from Lomanic/mktypes-gofmt
Make mktypes.sh generate go-fmt-ed code and make it shellcheck-compliant
2020-09-13 20:13:22 +02:00
shirou
4a5b404d76
Merge pull request #943 from boogie-byte/dry-host
Refactor "host" package
2020-09-13 21:13:46 +09:00
Lomanic
8784f48735
Merge pull request #940 from Lomanic/issue985
[process][darwin] Fix #925 remove references to removed const unix.SYS___SYSCTL from x/sys/unix
2020-09-12 01:06:54 +02:00
Sergey Vinogradov
5209442b3c Refactor "host" package 2020-09-11 18:54:53 +03:00
Ata
5fd5d64304
Cache common/common_linux.Virtualization()
By assuming virtualization environment won't change during a the program's runtime, we can cache common/common_linux.Virtualization() with a simple map to reduce amount of system calls. I first mentioned this issue at https://github.com/shirou/gopsutil/pull/890#issuecomment-690211919
2020-09-11 10:41:01 +03:00
Lomanic
e1082dabb6 [process][darwin] Fix #925 remove references to removed const unix.SYS___SYSCTL from x/sys/unix
More like a workaround, wanted to port process.getKProcWithContext() to use unix.SysctlRaw() to get rid of exec calls to ps
in the same time but didn't have time.
2020-09-08 11:44:46 +02:00
Lomanic
8a625ec054 [host][process][darwin] Go-fmt code from mktypes.sh from #917 2020-09-07 21:12:17 +02:00
Lomanic
2e4fcbb8c4
Merge pull request #917 from amdprophet/darwin-arm64
Add support for Darwin/ARM64
2020-09-07 21:10:27 +02:00
Lomanic
401aff67d3 Make mktypes.sh generate go-fmt-ed code and make it shellcheck-compliant
See https://github.com/shirou/gopsutil/pull/917#issuecomment-683911339
2020-09-07 20:16:12 +02:00
Lomanic
4cfc60d68b
Merge pull request #928 from Lomanic/skip-tests-when-not-implemented 2020-09-06 13:33:31 +02:00
shirou
e25aa96aad
Merge pull request #936 from ninedraft/fix-context-usage
Use cancelable sleep
2020-09-05 10:53:34 +09:00
ninedraft
baf3495197 use legacy error check in the common.TestSleep 2020-09-03 23:07:04 +03:00
ninedraft
34df4904f6 use cancelable sleep in cpu.PercentWithContext and process.Process.PercentWithContext 2020-09-03 23:01:53 +03:00
Lomanic
e1925b853e
Merge pull request #935 from Lomanic/issue900
[linux] Fix #900, skip or fix failing tests in docker
2020-09-02 10:35:27 +02:00
Lomanic
1b3e0c6643 [linux] Fix #900, skip or fix failing tests in docker
TestGetProcInodesAll: create a server so there are some opened inodes
TestUsers: skip if Users is empty, because of an empty /var/run/utmp
Test_Process_Groups: skip if Groups is empty
TestConnectionsMax: skip on CI, not only CircleCI
2020-09-02 01:06:17 +02:00
Lomanic
ffaff45e9c
Merge pull request #932 from tklauser/openbsd-cpu
Use unix.SysctlUint32("hw.ncpuonline") on OpenBSD
2020-09-01 15:23:21 +02:00
Tobias Klauser
548c500117 Use unix.SysctlUin32("hw.ncpuonline") on OpenBSD
Use SysctlUvmexp from golang.org/x/sys/unix to avoid having to simplify
the implementation of cpu.InfoWithContext

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-09-01 11:22:28 +02:00
Lomanic
9aa2bee419
Merge pull request #933 from Lomanic/openbsd-host-mem-process-types
[host][mem][process][openbsd] Add 386 const and types definitions
v2.20.8
2020-09-01 00:13:38 +02:00
Lomanic
84afaae670 [host][mem][process][openbsd] Add 386 const and types definitions
Continuation of #721, this type using mktypes.sh that I didn't know at the time.
Weirdly, `go tool cgo -godefs` doesn't produce propery go-fmt-ed code, had to do run go-fmt manually afterwards.
2020-09-01 02:02:21 +02:00
Lomanic
7f588ac380
Merge pull request #930 from tklauser/openbsd-uvmpexp
Use unix.SysctlUvmexp on OpenBSD
2020-08-31 19:46:31 +02:00
Lomanic
e643eaefcc
Merge pull request #931 from tklauser/openbsd-mem-test-fix
Fix TestVirtual_memory on OpenBSD
2020-08-31 16:57:20 +02:00
Tobias Klauser
62354ea032 Fix TestVirtual_memory on OpenBSD
On OpenBSD, the total is used + free + cached + inactive like on macOS.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-08-31 12:42:46 +02:00
Tobias Klauser
aacbba22ae Use unix.SysctlUvmexp on OpenBSD
Use SysctlUvmexp from golang.org/x/sys/unix to avoid having to define
the type Uvmexp and the sysctl consts. This will also allow to build on
GOOS=openbsd with e.g. GOARCH=arm64.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-08-31 12:38:11 +02:00
Lomanic
c4663018cc
Merge pull request #923 from disconnect3d/patch-2
net_linux.go: decode port as uint16 instead of int64
2020-08-30 18:43:20 +02:00
Lomanic
d9f9a85e75
Merge pull request #924 from nightmared/fix-utf16-windows
fix an invalid shift in windows processes name UTF16 conversion
2020-08-29 18:52:44 +02:00
Lomanic
ab084b525c [net] Skip tests on non-implemented platforms #446 2020-08-29 18:39:50 +02:00
Lomanic
ea86cbc3ff [mem] Skip tests on non-implemented platforms #446 2020-08-29 18:39:50 +02:00
Lomanic
78a65a67a9 [load] Skip tests on non-implemented platforms #446 2020-08-29 18:39:50 +02:00
Lomanic
8110480793 [host] Skip tests on non-implemented platforms #446 2020-08-29 18:39:44 +02:00
Lomanic
b7781f5858 [disk] Skip tests on non-implemented platforms #446 2020-08-29 18:29:36 +02:00
Lomanic
38f6ed0e0c [cpu] Skip tests on non-implemented platforms #446 2020-08-29 18:29:04 +02:00
Disconnect3d
5c1a9e709d net_linux.go: decode port as 16-bit uint
Changes the port parsing from `/proc/net/*` files records from parsing them as 64-bit integers to parse them as 16-bit unsigned integers.

While this is mostly a cosmetic change, it will also make so that the code fails faster in case the entry is malformed (for whatever reason).

Note that the returned value is still casted to uint32 when an  `Addr` object is created.
It seems to me that the `Addr.port` field should be changed to `uint16` but maybe some other APIs/systems wants it to be `uint32` and also changing it there may require changes in users code if they update. This being said I am not changing that field's type.
2020-08-28 00:31:50 +02:00
Simon Thoby
04a6f81e9f fix an invalid shift in windows processes name UTF16 conversion 2020-08-25 11:59:41 +02:00
Justin Kolberg
53ffb0cece Add support for Darwin/ARM64
Signed-off-by: Justin Kolberg <amd.prophet@gmail.com>
2020-08-10 21:26:24 -07:00
shirou
7e94bb8bcd
Merge pull request #775 from TakayukiBGoto/add_additional_gids_support
[Process] Implement Groups() to get additional gids.
v2.20.7
2020-07-24 22:09:41 +09:00
shirou
4e6138ae09
Merge pull request #901 from nightmared/expose-available-memory-as-free-win
Set the 'free' memory value to the 'available' memory on windows
2020-07-24 14:00:27 +09:00
shirou
bbcb80cd3f
Merge pull request #891 from tribes/master
[process][windows] implement suspending and resuming with ntdll library
2020-07-24 13:56:50 +09:00
shirou
efc768ada6
Merge pull request #898 from tyldavis/master
Fix MemoryMaps on ARM
2020-07-24 12:39:17 +09:00
shirou
7a4809ba68
Merge pull request #908 from tklauser/host-bsd-boottime
Use common implementation for BootTime/Uptime on all BSDs
2020-07-24 12:34:48 +09:00