Commit Graph

444 Commits (68512056e8696381f82ddce6f07abad4ea7ca864)

Author SHA1 Message Date
shirou 7ec134321c
Merge pull request #1713 from joshiste/joshiste-precise-create-time
Fix resolution for process create time limited to seconds
shirou 4140cda4ac
Merge pull request #1702 from uubulb/purego_darwin
feat(cpu, mem, sensors, disk, process)(darwin): cgo-free implementations
Johannes Edmeier 3dc12249d3
Allow subsecont precision for process create time
huang 462736cb8b add comment for NumFDsWithContext
uubulb 9e6efdb991 update disk & cpu & process
huang cbc32afb65 implement NumFDs for Windows
Lomanic 76ccf0d220 [process][darwin][freebsd][linux][openbsd] Make process.Children not reliant on pgrep
pgrep -P $PID exits with status of 1 (and nothing in stdout nor stderr) both if
a process doesn't exist or it doesn't have child processes, so we don't
use it anymore on these OSes. We sort PIDs as pgrep did.

Also deprecate the ErrorNoChildren error when there are no child processes,
this is erroneous (simply check for the length of the returned slice, plus
this is not an error per se), this was only returned on linux anyway.

Fixes #1698
shirou 74cb403730
Merge pull request #1694 from fivitti/master
Fix panic on OpenBSD and FreeBSD systems if KinfoProc size has an unexpected size
Cnpt 829f2fafbd
Refactoring the algorithm for calculating CPU usage (#1692)
refactor(process): Refactoring the algorithm for calculating CPU usage
shirou 2a37a1d32b
Merge pull request #1691 from pgimalac/pgimalac/fix-proc-smaps-parsing
Fix parsing of /proc/pid/smaps when path is empty
shirou 37f531010d fix golangcilint errors, ignore gosec G115
Slawek Figiel 977269202e fix: handle invalid KinfoProc size on BSD systems
Pierre Gimalac d4ac231298
Merge branch 'master' of github.com:pgimalac/gopsutil into pgimalac/fix-proc-smaps-parsing
Pierre Gimalac a1f9e69b5d
fix: join path elements in case it contains spaces
shirou 5f158096be fix: golangci lint with max -> maxConn
Pierre Gimalac 33251d10ec
fix(proc): parsing of smaps path
shirou 6bdbf65126 [process]: Introduce DiskReadBytes on process which shows Disk IO only.
shirou e9591b5b01 rename redundant test function names, such as TestCPU in cpu package
shirou 85f5f3a8e2 process.Uids and process.Gids are now return uint32
Sergey Chernomorets aace5e9d8f Groups in /proc/PID/status has type uint32.
Fix error of parser:
> error get info about worker process status 3150292: strconv.ParseInt:
> parsing "4294967293": value out of range

$ grep Groups /proc/self/status
Groups: 20001 [...] 4294967293
shirou bc060cc227 add SPDX License, remove old build tag, and replace import
shirou 4336530318
Merge pull request #1649 from shirou/feat/add_process_cwd_openbsd
[process][openbsd]: add cwd on openbsd.
shirou 57d4c8a90a [process][openbsd]: add cwd on openbsd.
mdrakos f4eca4318c Add fallback for lsof output
shirou 94b8051c1a [process][freebsd]: re-generate types on freebsd arm64
Jonathan Matthew 27ffa28a0d add support for OpenBSD/riscv64
shirou e912ebde7a
Merge pull request #1580 from jnewmano/patch-1
Windows, read all PIDs if there are more than 1024 PIDs.
Jason Newman 15f7946fcb
Windows, read all pids if there are more than 1024 pids.
Convert bytes read to number of uint32s that were read.
shirou b10acd4894 [host]: add EnableBootTimeCache function
Chris Gianelloni a8418dfd73 feat: use lsof for net_connections on FreeBSD
Use net.ConnectionsPidWithContext on FreeBSD, similarly to how it is done
on Darwin. This uses common.CallLsofWithContext underneath the hood, which
will use lsof under the hood, if available.

Tested on FreeBSD 13.2-RELEASE

Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
shirou 83427f964f [process][darwin]: skip process.Nice test if darwin on GitHub Action
fix: https://github.com/shirou/gopsutil/issues/1532
Matthieu MOREL c806740b34
ci(lint): ensure io/ioutil replacement (#1525)
* ci(lint): enure ioutil replacement

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update host_solaris.go
* Update process_linux_test.go
* Update net_linux_test.go
* Update net_linux_test.go
* Update process_test.go
* Update process_linux_test.go
* Update process_linux_test.go

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
shirou 0665cafa1b chore: replace deprecated ioutil package to os and io
shirou febdeab871 chore: change CIRCLECI environment variable to CI.
Antoine Toulme 54c31d884d
Revert "test results"
This reverts commit ae119d36b8.
Antoine Toulme ae119d36b8 test results
Antoine Toulme 6fff1c0e99
proper benchmark
Antoine Toulme ca71a6db3c
lint
Antoine Toulme a48fd71137
Revert "send results"
This reverts commit a7a94986fb.
Antoine Toulme a7a94986fb send results
Antoine Toulme 4bc9e37b0f
faster file read
Lomanic 8b96d2e9e2 [process][posix] Realign process.Name() with python psutil to return same value on python3 scripts processes
e2c79a1 started to blindly set the process name to the full path (instead of the basename) of the cmdline exectuable
if the process name from the process comm was truncated on linux. Python psutil never did that, and this is just wrong
for python (or any executable interpreted script) where the process name is not the interpreter binary but the script
itself.

A new test to check process name value against psutil value is added here, which would hopefully catch any potential
future changes in psutil.

Reverts #542

Fixes #1485
Lomanic c0f3eb1dfb [process] Remove all noisy and useless Test_AllProcesses_X tests
These tests can't fail more than their invidiual counterparts and produce an incredibly verbose output
Antoine Toulme b712e59295 fix more linting reports
Antoine Toulme 38b94668ea allow to pass context values to override environment variables
cui fliter 9aa4e7a744 fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
Eng Zer Jun 0439039205
refactor(process): compare error with `errors.Is`
Starting from Go 1.13, `errors.Is` is the preferable way to compare
error equality [1].

[1]: https://go.dev/blog/go1.13-errors

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Matthieu MOREL 1fb1e3e3e6 ci(lint): correct gci linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Donal Hurley cf25de7460 Add support for getting process exe in FreeBSD
shirou 852f455217 fix lint