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

444 Commits

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
2024-09-26 22:58:15 +09:00
shirou
4140cda4ac
Merge pull request #1702 from uubulb/purego_darwin
feat(cpu, mem, sensors, disk, process)(darwin): cgo-free implementations
2024-09-26 22:37:05 +09:00
Johannes Edmeier
3dc12249d3
Allow subsecont precision for process create time 2024-09-24 18:50:58 +02:00
huang
462736cb8b add comment for NumFDsWithContext 2024-09-23 22:05:49 +08:00
uubulb
9e6efdb991 update disk & cpu & process 2024-09-20 22:24:12 +08:00
huang
cbc32afb65 implement NumFDs for Windows 2024-09-19 23:59:11 +08:00
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
2024-09-10 15:34:36 +02:00
shirou
74cb403730
Merge pull request #1694 from fivitti/master
Fix panic on OpenBSD and FreeBSD systems if KinfoProc size has an unexpected size
2024-08-26 23:54:23 +09:00
Cnpt
829f2fafbd
Refactoring the algorithm for calculating CPU usage (#1692)
refactor(process): Refactoring the algorithm for calculating CPU usage
2024-08-24 21:46:32 +09:00
shirou
2a37a1d32b
Merge pull request #1691 from pgimalac/pgimalac/fix-proc-smaps-parsing
Fix parsing of /proc/pid/smaps when path is empty
2024-08-24 17:21:17 +09:00
shirou
37f531010d fix golangcilint errors, ignore gosec G115 2024-08-23 08:22:42 +00:00
Slawek Figiel
977269202e fix: handle invalid KinfoProc size on BSD systems 2024-08-20 12:40:07 +02:00
Pierre Gimalac
d4ac231298
Merge branch 'master' of github.com:pgimalac/gopsutil into pgimalac/fix-proc-smaps-parsing 2024-08-19 10:36:07 +02:00
Pierre Gimalac
a1f9e69b5d
fix: join path elements in case it contains spaces 2024-08-19 10:34:55 +02:00
shirou
5f158096be fix: golangci lint with max -> maxConn 2024-08-17 22:41:29 +09:00
Pierre Gimalac
33251d10ec
fix(proc): parsing of smaps path 2024-08-14 19:06:48 +02:00
shirou
6bdbf65126 [process]: Introduce DiskReadBytes on process which shows Disk IO only. 2024-05-28 22:27:17 +09:00
shirou
e9591b5b01 rename redundant test function names, such as TestCPU in cpu package 2024-05-28 22:27:17 +09:00
shirou
85f5f3a8e2 process.Uids and process.Gids are now return uint32 2024-05-28 22:27:17 +09:00
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
2024-05-28 22:27:17 +09:00
shirou
bc060cc227 add SPDX License, remove old build tag, and replace import 2024-05-28 22:27:17 +09:00
shirou
4336530318
Merge pull request #1649 from shirou/feat/add_process_cwd_openbsd
[process][openbsd]: add cwd on openbsd.
2024-05-28 22:20:00 +09:00
shirou
57d4c8a90a [process][openbsd]: add cwd on openbsd. 2024-05-14 22:56:17 +09:00
mdrakos
f4eca4318c Add fallback for lsof output 2024-05-06 14:42:06 -07:00
shirou
94b8051c1a [process][freebsd]: re-generate types on freebsd arm64 2024-03-12 23:52:30 +09:00
Jonathan Matthew
27ffa28a0d add support for OpenBSD/riscv64 2024-02-11 16:20:56 +10:00
shirou
e912ebde7a
Merge pull request #1580 from jnewmano/patch-1
Windows, read all PIDs if there are more than 1024 PIDs.
2024-01-19 22:35:54 +09:00
Jason Newman
15f7946fcb
Windows, read all pids if there are more than 1024 pids.
Convert bytes read to number of uint32s that were read.
2024-01-11 13:04:15 -07:00
shirou
b10acd4894 [host]: add EnableBootTimeCache function 2024-01-11 00:49:11 +09:00
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>
2023-11-09 18:19:10 -05:00
shirou
83427f964f [process][darwin]: skip process.Nice test if darwin on GitHub Action
fix: https://github.com/shirou/gopsutil/issues/1532
2023-10-07 13:27:39 +00:00
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>
2023-09-12 21:14:04 +09:00
shirou
0665cafa1b chore: replace deprecated ioutil package to os and io 2023-09-08 17:05:14 +00:00
shirou
febdeab871 chore: change CIRCLECI environment variable to CI. 2023-08-30 14:07:47 +00:00
Antoine Toulme
54c31d884d
Revert "test results"
This reverts commit ae119d36b8280344151f33a5db5c4a5d58faff89.
2023-08-27 10:01:46 -07:00
Antoine Toulme
ae119d36b8 test results 2023-08-27 09:58:08 -07:00
Antoine Toulme
6fff1c0e99
proper benchmark 2023-08-27 09:42:51 -07:00
Antoine Toulme
ca71a6db3c
lint 2023-08-25 14:38:11 -07:00
Antoine Toulme
a48fd71137
Revert "send results"
This reverts commit a7a94986fb9b6deeef51eb25c71a73c1d1c9becc.
2023-08-25 14:33:37 -07:00
Antoine Toulme
a7a94986fb send results 2023-08-25 14:18:48 -07:00
Antoine Toulme
4bc9e37b0f
faster file read 2023-08-25 13:54:26 -07:00
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
2023-07-09 00:43:24 +02:00
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
2023-07-01 14:44:04 +02:00
Antoine Toulme
b712e59295 fix more linting reports 2023-06-03 14:17:16 -07:00
Antoine Toulme
38b94668ea allow to pass context values to override environment variables 2023-06-02 01:31:05 -07:00
cui fliter
9aa4e7a744 fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-05-09 16:42:07 +08:00
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>
2023-04-24 15:00:01 +08:00
Matthieu MOREL
1fb1e3e3e6 ci(lint): correct gci linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-04-04 18:07:22 +00:00
Donal Hurley
cf25de7460 Add support for getting process exe in FreeBSD 2023-03-09 11:46:40 +00:00
shirou
852f455217 fix lint 2023-02-12 09:24:52 +00:00