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

1609 Commits

Author SHA1 Message Date
shirou
3202231bcd
Merge pull request #966 from boogie-byte/dry-process
Refactor "process" package
2020-10-18 18:16:16 +09:00
Lomanic
34fbc94ac1
Merge pull request #963 from AtakanColak/simpler-virt-cache
Simplify Fix Virtualization Cache Race Condition
2020-10-16 00:40:38 +02:00
Lomanic
278ae7d3a6
Merge pull request #970 from Lomanic/issue958 2020-10-16 00:15:39 +02:00
Lomanic
32d4603d01 [disk][darwin] fix build with latest golang.org/x/sys/unix
Fixes #958
2020-10-15 23:59:25 +02:00
Atakan
3504ea07b0 simplify virt cache 2020-10-13 11:06:20 +03:00
Sergey Vinogradov
065e609cbf Refactor "process" package
* All context-less wrapping functions (the ones without WithContext
suffix) were moved into process.go since they all are the same.
* Call context is now passed to all underlying functions in
*WithContext() functions.
* All common *BSD bits were moved to process_bsd.go.
* Process.Tgid() method lacked a WithContext counterpart, so
Process.TgidWithContext() was added for uniformity.
* NewProcessWithContext() function was added since NewProcess() is
used a lot throughout the module, and there is no way to pass a
context to it.

This is a part of #761 effort.
2020-10-12 18:15:29 +03:00
shirou
b94f262e7d
Merge pull request #949 from boogie-byte/vet-target
Add "vet" target to the Makefile
2020-10-11 23:01:10 +09:00
shirou
7144fe3fff
Merge pull request #955 from fancybits/disk-bind-root
[disk][linux] flag bind mounts
2020-10-11 21:19:38 +09:00
shirou
ad46664943
Merge pull request #951 from rmfitzpatrick/fix_virtualization_race
Fix VirtualizationWithContext() race in linux
2020-10-11 21:03:32 +09:00
shirou
fe68b86b08
Merge pull request #948 from AtakanColak/windows-cache-ppid
Cache Process Parent ID in Windows
2020-10-11 18:52:27 +09:00
Sergey Vinogradov
8ff2ab3187 Add "vet" target to the Makefile
Making the "vet" target will run "go vet ./..." for each supported
GOOS.

Also, some of the warnings produced by go 1.15 vet were mitigated.
2020-10-10 16:50:49 +03:00
Aman Karmani
23d63601d1 [disk][linux] flag bind mounts 2020-10-07 11:01:01 -07:00
Ryan Fitzpatrick
8046134504
Fix VirtualizationWithContext() race in linux 2020-10-06 17:03:49 +00:00
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
Atakan Çolak
7cc8d3f711 cache ppid in windows 2020-10-01 11:17:40 +03: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