Commit Graph

38 Commits

Author SHA1 Message Date
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
Laurent Sesques b3cfb9abc3 Revert "[process] Fix #599 cap percent values returned by *Percent() between 0 and 100"
This reverts commit f4e23559a2.
Fixes #755
2019-10-15 14:25:43 +02: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
Shirou WAKAYAMA 4bb84648bf JSON representation is renamed to fit Google JSON style, camelCase. 2016-03-23 10:52:46 +09:00
Shirou WAKAYAMA ea152ea901 [BREAKING CHANGE] rename functions to pass golint. ex) net.NetIOCounters -> net.IOCounters 2016-03-22 23:09:12 +09:00
Shirou WAKAYAMA 627d2a9871 [process]: fix CPU_Percent always 0 if duration > 0 (#172) 2016-03-09 10:09:27 +09:00
Johan Walles 70444b571b process: Implement platform independent MemoryPercent()
It calls mem.VirtualMemory() and process.MemoryInfo(), so on the platforms where
those work MemoryPercent() will as well.

Tested on Darwin.
2016-02-16 20:22:04 +01:00
Johan Walles ebaa641e63 Make a public function for computing total CPU time
This function used to be a private part of process.go.

Since I needed that functionality however I think it's better to make it public
than for me to copy it into my own code.

As a side effect of this change, I also fixed a bug in the function where Stolen
was not part of the sum. Having the function close to the CPUTimesStat
declaration will make problems like this less likely to re-occur in the future.
2016-02-10 17:53:39 +01:00
Cameron Sparr 6688f35cd1 Optimize per-process stats calculation 2016-01-19 21:36:45 -07:00
Daniel Theophanes 0af895258e common: rename package common to internal/common. Add ENV helper funcs.
Package common wasn't used for public functions. Place it in an
internal directory to prevent other packages from using.

Remove the distributed references to "HOST_PROC" and "HOST_SYS"
consts and combine into a common function. This also helps so that
if a env var is defined with a trailing slash all will continue to
work as expected.

Fixes #100
2015-10-18 20:40:01 -07:00
Shirou WAKAYAMA fc513b6f9a proces[darwin]: change exec.Command to interface to enable mocking.
Add common.invoker interface to mock exec.Command. common.FakeInvoker returns
expected file if exists instead of invoke exec.Command.
Currenly, mocking is enabled only process.Pids(). I will expand to other funcs incrementally.
2015-09-16 11:58:02 +09:00
Shirou WAKAYAMA 8db78af11e process: CPUPercent delta should be changed by CPUNums. 2015-03-17 17:03:03 +09:00
Shirou WAKAYAMA 2093d43c2a process: implement cpu_percent on linux. 2015-03-04 00:02:09 +09:00
Shirou WAKAYAMA 13cd195a7e change package name. 2014-12-30 22:09:05 +09:00
Shirou WAKAYAMA a4671fcc2a move subdirectories. refer to issue #24 2014-11-27 10:18:15 +09:00