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

104 Commits

Author SHA1 Message Date
tycho garen
08a382b207 make process.processes function public 2017-11-05 20:40:33 -05:00
Leonid Podolny
7ee4a4c6ff Fix Threads() signature to better match python original 2017-10-04 15:38:01 -04:00
Leonid Podolny
7ad3836ad3 Implement Threads() for Linux 2017-10-04 15:38:01 -04: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
Chris Roberts
9c998f664a Fix process.Exe() on macOS 10.12
The `lsof` command on macOS < 10.12 always selects the `p` field
when using the `-F` option. On macOS 10.12 the `f` field is also
always selected causing an incorrect result. This modification adds
both options which are always selected to maintain consistency.
2017-07-16 08:13:49 -07:00
Sean Chittenden
635b971c0e
Move from the syscall package to the golang.org/x/sys/{unix,windows} 2017-06-02 13:51:00 -07:00
Patrick Hemmer
60c32eb847 add current values to rlimit retrieval 2017-06-01 16:38:44 -04:00
Sean Chittenden
d0e40ff723
Fix issues reported by golint. 2017-04-27 14:21:34 -07:00
tycho garen
6110db7ab5 error earlier on darwin for get parent pid 2017-02-14 17:36:34 -05:00
Nex
189b8e6d12 Fixed missing bin and unused stderr 2016-10-21 13:22:09 +02:00
Nex
b6a7649aab Error handling 2016-10-21 13:20:58 +02:00
Nex
d9b355f75e Added proper piping of commands 2016-10-21 13:16:22 +02:00
Nex
dd3cbcc611 Trying remove single quotes 2016-10-21 12:36:58 +02:00
Nex
1534b109ae Fixing pid name 2016-10-21 12:27:14 +02:00
Nex
8c3e7bd255 Casting pid properly 2016-10-21 12:26:00 +02:00
Nex
9659355f49 Checking content 2016-10-21 12:21:10 +02:00
Nex
8bb06aca3d Fixed type casting 2016-10-21 12:15:15 +02:00
Nex
5481d93989 Fixing assignment of vars 2016-10-21 12:10:41 +02:00
Nex
4f7834af25 Added attempt to get exe path from pid 2016-10-21 12:07:28 +02:00
Tom Elliott
1435987652 Correctly handle long running processes on OSX
The full etime format is dd-hh:mm:ss. Replacing '-' with ':' fixes parsing of this format.
2016-08-26 11:49:57 -04:00
Tom Elliott
3855e7ba0e Implement CreateTime for darwin. Parses elapsed time and converts this to epoch time. 2016-08-20 23:38:36 -04:00
Shirou WAKAYAMA
613a8a90e1 fixed by golint. 2016-04-01 21:34:39 +09:00
Shirou WAKAYAMA
944429d994 fixed by errcheck 2016-04-01 21:02:20 +09:00
Shirou WAKAYAMA
46ddd57c72 process has NetIOCounters and IOCounters. 2016-03-22 23:23:08 +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
Chris Gilling
8c186ae593 process: add CmdlineSlice for darwin + windows
darwin will not perform correctly if there are spaces in the actual
arguments, in which case a single argument will be reported as
multple. Some CGO would be needed to get around this I think.

I couldn't find any good documentation on how windows handles
command line arguments with spaces inside the actual arguments, so
this implementation merely just splits on spaces.
2016-02-28 19:49:50 -08:00
Chris Gilling
b8c40ac83c process: add CmdlineSlice function for linux + freebsd
This allows for getting more exact information about each argument
especially if there are arguments that have spaces in them.

This was not implemented for darwin or for windows because they
both currently have not way of properly parsing the cmdline string.
Darwin parses the output of 'ps' which is already whitespace
segmented, and windows just has the cmdline string.
2016-02-27 18:01:49 -08: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
Shirou WAKAYAMA
e21c97d3b2 [process]darwin: forget to change as binary.go movement. 2016-02-12 23:53:53 +09:00
Johan Walles
09fbecef59 Darwin: Remove questionable UIDs
process.Process.uids is an array of undocumented values.

That one of them is the user that the process is running as is obvious, but what
the other two are supposed to be is AFAICT undocumented.

On Darwin, the second and third UID (out of three) seem to always be 0.

This change removes the two always-zero UIDs from the process.Process struct on
Darwin, and leaves just the one that actually identifies the user the process
is running as.
2016-02-12 10:58:55 +01:00
Johan Walles
e3a7a45492 process.Username(): Correct user names on Darwin
Before this change, process.Username() returned "root" for all processes on
Darwin.
2016-02-12 10:54:41 +01:00
Heretic
a0692cc17a 1)fix callps command generate error 2016-02-02 18:52:57 +08:00
shirou
9d8191d6a6 Merge pull request #137 from shirou/process/add_netiocounter_for_linux
[WIP] net,process[linux]: add process.NetIOCounter and net.NetIOCounterByFile.
2016-01-29 23:41:05 +09:00
Cameron Sparr
f251637a93 Add -a when calling ps on darwin 2016-01-26 14:18:50 -07:00
Shirou WAKAYAMA
d680853370 net,process[linux]: add process.NetIOCounter and net.NetIOCounterByFile. 2016-01-21 17:31:05 +09:00
Olivier Vielpeau
ec627e67ac process[darwin] Fix unit of RSS and VMS
Should be bytes, `ps` returns Kbytes.
2015-12-14 12:13:27 +01:00
Shirou WAKAYAMA
dd13300833 process[linux,freebsd,darwin]: implements Children using pgrep. 2015-11-24 00:04:20 +09:00
Shirou WAKAYAMA
7288e9a5af common[all]: add internal 2015-10-20 00:04:57 +09:00
Shirou WAKAYAMA
b3cf7354f6 process[linux, darwin]: implements Connections using lsof. 2015-09-18 13:36:13 +09:00
Shirou WAKAYAMA
c50db4f462 net[darwin]: implement NetConnections(). 2015-09-16 16:13:00 +09:00
Shirou WAKAYAMA
d6ac361a24 process[darwin,linux]: implements Parent using lsof. 2015-09-16 13:06:07 +09: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
jay park
2984accfa1 return error when CPUTimes fails on callPs, modify comments on ReadLines 2015-09-13 13:05:09 +09:00
Hideo Hattori
4d4bd26b06 implement NumThreads on darwin. use ps command 2015-06-16 22:01:02 +09:00
Hideo Hattori
6ec0f72a72 implement CPUTimes (and CPUPercent) on darwin. use ps command. 2015-06-15 16:35:52 +09:00
Shirou WAKAYAMA
1851e63d38 process: callPs can get from all process and Ppid() uses ps command on darwin. 2015-03-11 11:38:02 +09:00
Shirou WAKAYAMA
6227460dc5 process: if pid < 0, skip it. and Cmdline retruned Joined string. 2015-03-11 11:19:19 +09:00
若山史郎
9d38e5c995 process: add meminfo, cmdline on darwin. 2015-03-06 11:02:59 +09:00
若山史郎
20c3ddbfe5 process: fix darwin kinfo_proc struct and introduce creation by godef. 2015-03-06 10:05:58 +09:00
Shirou WAKAYAMA
c61c09295c process: delete CPUPercent on the every architecture dependent part. 2015-03-04 00:04:29 +09:00