uubulb
9e6efdb991
update disk & cpu & process
2024-09-20 22:24:12 +08: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
5f158096be
fix: golangci lint with max -> maxConn
2024-08-17 22:41:29 +09:00
shirou
6bdbf65126
[process]: Introduce DiskReadBytes on process which shows Disk IO only.
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
b10acd4894
[host]: add EnableBootTimeCache function
2024-01-11 00:49:11 +09:00
cui fliter
9aa4e7a744
fix some comments
...
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-05-09 16:42:07 +08:00
Ville Skyttä
1e56c6f421
Spelling and grammar fixes
2022-01-30 22:48:09 +02:00
Ville Skyttä
0306525d78
[process] implement ParentWithContext using PpidWithContext
...
Removes need for redundant ParentWithContext implementations. It had led
to it being unsupported on FreeBSD and OpenBSD even though
PpidWithContext was available for them, and different implementations
for getting the parent info used in ParentWithContext and
PpidWithContext on Darwin and Linux.
2022-01-22 18:27:52 +02:00
Matthieu MOREL
b673968d5d
enable errorlint linter
2021-12-04 22:29:38 +01:00
shirou
d2e27c1712
fix dependabot v2 deletion.
2021-12-01 00:12:55 +00:00
shirou
0969c9436b
delete v2 directory, move v3 to top #1078
2021-11-30 23:47:59 +00:00
Max Altgelt
b02b92e16b
feat: Add support for environment variable read
...
Add support (for Linux and Windows for now) for reading the
environment variables of a process, with a similar syntax to
os.Environ().
For Windows, this includes some refactoring for clean access to the
RTL_USER_PROCESS_PARAMETERS structure which points to the command
line and the environment variables.
2021-07-13 15:11:29 +02:00
Mya
cb512c8500
simplify mutex usage
2021-06-24 15:18:00 -07:00
Paweł Zuzelski
17c03b3b2d
Clarify the godoc of the Children function.
...
The previous godoc string was slightly confusing and only described information that can be deduced from the function signature.
2021-02-04 18:03:52 +01:00
shirou
a9a6146c93
[process] fix MemoryInfo comment. remove Swap
...
fixes #1012
2021-01-14 19:00:55 +09:00
AtakanColak
13602a3824
fix ppid cache race condition #964
2020-10-23 11:38:02 +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
ninedraft
34df4904f6
use cancelable sleep in cpu.PercentWithContext and process.Process.PercentWithContext
2020-09-03 23:01:53 +03:00
shirou
7e94bb8bcd
Merge pull request #775 from TakayukiBGoto/add_additional_gids_support
...
[Process] Implement Groups() to get additional gids.
2020-07-24 22:09:41 +09:00
Lomanic
e34a731c69
[process] Fix #773 remove data race in NewProcess
...
Reproduction case https://github.com/shirou/gopsutil/issues/773#issuecomment-554723678
2019-11-17 20:17:23 +01:00
TakayukiB Goto
a93796494b
[Process] Define the Groups() only once
2019-10-24 18:42:13 +09:00
Laurent Sesques
b3cfb9abc3
Revert "[process] Fix #599 cap percent values returned by *Percent() between 0 and 100"
...
This reverts commit f4e23559a2bad85fca1eeea695331ce38ff3f494.
Fixes #755
2019-10-15 14:25:43 +02:00
TakayukiB Goto
f55f202e81
[Process] Implement Groups() to get additional gids.
2019-10-07 12:59:36 +09:00
Lomanic
547679f88e
[process] Fix #760 implement IsRunning by checking process with same PID has same CreateTime as current process
2019-09-07 18:54:49 +02:00
Lomanic
3eefe64948
[process] Fix #752 sort PIDS returned by process.Pids()
2019-08-24 09:08:28 +02:00
Lomanic
3465186bca
[process] Fix #729 check process existence in NewProcess()
2019-08-01 21:12:48 +02:00
shirou
3ad4fbbb0c
Merge pull request #715 from Lomanic/issue599process
...
[process] Fix #599 cap percent values returned by *Percent() between 0 and 100
2019-07-27 21:45:36 +09:00
Lomanic
f4e23559a2
[process] Fix #599 cap percent values returned by *Percent() between 0 and 100
2019-07-07 20:24:04 +02:00
Lomanic
5b15bc623c
[process][posix] Fix #607 check pid existence with a signal instead of listing every pids
...
Reference 0d6b91e916/lockfile_unix.go
2019-07-07 16:41:13 +02:00
shirou
457f04671d
[process] move PageFaultsStat to process.go
2019-01-13 17:27:42 +09:00
shirou
98c84ed30a
[process]: move HWM to MemoryInfo
...
at least FreeBSD and Darwin has HWM.
2019-01-13 17:23:01 +09:00
Lomanic
878e0a701b
Fix #596 Implement process.Background and process.Foreground functions
2018-11-08 20:52:01 +01:00
shirou
26a4a2f995
[process]: move ErrorNoChildren to platform independent.
2018-03-24 15:56:32 +09:00
Laurie Clark-Michalek
413cb32b6c
Use static initialisation for invoke instances, instead of init funcs
...
The order of init function execution is dependant on the order that the
source files are passed to the compiler. This causes issues when
building under other build systems, such as bazel or buck, as they are
not guarenteed to maintain the same file order as the default go tool.
2018-03-21 14:08:39 +00:00
shirou
cd61c36c4f
Merge branch 'master' into feature/add_context_support
2018-01-09 11:18:25 +09:00
Nick Kirsch
482ca3af6d
Parses the tgid field, which is the thread group id (aka user-space process id) on Linux. Returns error on other platforms.
2018-01-04 11:30:39 -08:00
shirou
4c73494c78
Add WithContext functions.
2017-12-31 15:25:49 +09:00
Leonid Podolny
4269f19b1b
process.go: reformat whitespaces to keep gofmt happy
2017-10-04 15:46:49 -04:00
Kemal Hadimli
826e63acbc
Never divide by zero
2017-09-28 15:54:06 +03:00
Kemal Hadimli
a3144a6850
Remove parens
2017-09-28 14:43:04 +03:00
Kemal Hadimli
696e1e0123
Fix NaN percentage if process was created too soon
2017-09-28 14:34:12 +03:00
shirou
a452de7c73
Merge pull request #346 from phemmer/rlimit-current
...
add current values to rlimit retrieval
2017-08-31 11:58:10 +09:00
Aditya Choudhary (c)
533161c2ed
added funtion for calculation of CPU usage percentage of a process
2017-07-23 02:39:35 +05:30
Patrick Hemmer
60c32eb847
add current values to rlimit retrieval
2017-06-01 16:38:44 -04:00
Vyacheslav Kuznetsov
a35c32b028
Commented the constants origin.
2017-01-11 19:05:34 +04:00
Vyacheslav Kuznetsov
4de4e17f06
Added limit constants. Implemented function to parse process limits from /proc.
2017-01-11 00:04:05 +04:00
Shannon Wynter
c903f14189
Remove the requirement to use lsof by using the information provided in status to get the parent pid
2016-04-18 11:15:15 +10:00