Commit Graph

115 Commits

Author SHA1 Message Date
Thomas Hipp 68ad8d603c
process: make `ClockTicks` arch-independent
The value for `ClockTicks` is defined as `100` by the Linux kernel for
all currently supported architectures in Go. Therefore, there is no need
to define this constant for each architecture separately.

This fixes #260.

Signed-off-by: Thomas Hipp <thomashipp@gmail.com>
2016-09-17 18:06:07 +02:00
Thomas Hipp eb4a57117f
process: determine page sizes via function
Instead of hard-coding the page size for linux systems, use Go's
`Getpagesize` function.

This resolves #258.

Signed-off-by: Thomas Hipp <thipp@suse.de>
2016-09-16 09:17:34 +02:00
shirou 79184fee44 Merge pull request #251 from theothertomelliott/master
Correctly handle long running processes on OSX
2016-08-29 14:31:36 +09:00
shirou a8e24d70f9 Merge pull request #247 from lfittl/fallback-for-unsupported-architectures
Add fallback code for all unsupported operating systems
2016-08-27 00:58:16 +09: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
Lukas Fittl da9fa1162b Add fallback code for all unsupported operating systems.
This enables using gopsutil in a codebase that gets built on other OSes
than the ones supported. Instead of a build failure as before, due to
the build tags, gopsutil will now throw an "not implemented" runtime
error.

Fixes #234.
2016-08-22 15:31:26 -07: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
Nick Cabatoff 28640e5d73 fix incorrect names for fields in proc/pid/io 2016-07-24 11:19:59 -04:00
Diptanu Choudhury af4c8608c9 Casting the values of working set and page file to uint64 2016-06-22 16:22:37 -07:00
Shirou WAKAYAMA c916da2502 [process]linux: add linux_arm64.go explicitly 2016-06-13 16:17:40 +09:00
shirou 6e9b0bbb1b Merge pull request #197 from shirou/process/add_memory_windows
Process/add memory windows
2016-05-30 14:06:48 +09:00
Shirou WAKAYAMA 1d461a68b6 [process]linux: porcess was not started. 2016-05-20 21:13:52 +09:00
Shirou WAKAYAMA 57f6aebc7e add Timeout to invoke command and use common.Invoke refs: #201 2016-05-20 17:59:41 +09:00
WAKAYAMA Shirou ba34a3af8c [process]windows: add IO counters and fix CreateTime 2016-05-04 23:25:43 +09:00
WAKAYAMA Shirou 903277ce2f [process]windows: implement process.MemoryInfo (but no swap) 2016-05-04 22:39:44 +09:00
WAKAYAMA shirou a9040e612c [process]freebsd: update 386. 2016-04-23 23:47:50 +09:00
Shirou WAKAYAMA 9ef341037b [process]posix: update process signal document 2016-04-20 13:29:54 +09:00
Shirou WAKAYAMA 860f5a0803 [process]linux: update comment to show godoc.org. 2016-04-20 13:26:05 +09:00
Shirou WAKAYAMA bd1b04fe67 [process]linux: add document to Status. 2016-04-20 12:59:18 +09:00
Shannon Wynter f99d495462 Run goimports before committing... 2016-04-18 17:28:47 +10:00
Shannon Wynter a4387d0c92 emulate original behaviour 2016-04-18 14:38:24 +10: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 bce9212def fix build bugs. 2016-04-01 22:22:03 +09:00
Shirou WAKAYAMA d21ed2b40d search path via exec.LookPath before actual invoke. 2016-04-01 22:13:05 +09: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 da89408631 Merge branch 'master' into v2 2016-03-31 18:08:24 +09:00
WAKAYAMA shirou 37d8908841 [process]freebsd: implementes proceess.Nice() 2016-03-31 17:34:09 +09:00
WAKAYAMA shirou 37b6b4051f [process]freebsd: process_freebsd_amd64.go is now generated by cgo godefs. 2016-03-31 17:19:49 +09:00
Shirou WAKAYAMA 15a7edb712 [process]linux: linux process status change to "R" not "Running" see #173 2016-03-27 21:54:02 +09:00
Shirou WAKAYAMA 4bb84648bf JSON representation is renamed to fit Google JSON style, camelCase. 2016-03-23 10:52:46 +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
Shirou WAKAYAMA 627d2a9871 [process]: fix CPU_Percent always 0 if duration > 0 (#172) 2016-03-09 10:09:27 +09:00
Shirou WAKAYAMA 715c421b57 [process]: add OpenFiles() test. 2016-03-04 09:42:40 +09:00
raviparimi be2dab5a40 Provide correct length for slice creation.
- Creating a slice of length numFDs and later appending elements to it
  results in a slice whose first numFDs elements are all nil. It is
  sufficient to create a slice of zero length since we are appending
  elements to it.
- The current allocation will make ret a slice of length 0. What's
  needed is a slice of length len(ofs).
2016-03-03 15:10:23 -08:00
Alexander Inozemtsev f4902fae49 Properly close opened file 2016-03-02 18:19:52 +03:00
Shirou WAKAYAMA 1de1357e77 [process]: add FailNow to avoid panic. 2016-02-29 21:59:02 +09:00
shirou 1ab11f7afd Merge pull request #167 from cgilling/cmdline_slice
process: add CmdlineSlice function for linux + freebsd
2016-02-29 21:57:08 +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 a3bbd9e3cd process: change linux NewProcess to only stat /proc/[pid]
Before it was doing a fillFromStatus() call which was much slower
and none of the information was needed, except by the Name() func
which now will call fillFromStatus() if p.name is not set.
2016-02-28 06:47:37 -08:00
Chris Gilling d098bf135f process: fix bug in CmdlineSlice where cmdline is empty
Sometimes (at least on linux) cmdline is empty, this was causing
a panic.
2016-02-27 18:29:24 -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
shirou 3618a777a8 Merge pull request #162 from shirou/load/add_misc
[load]all: add Misc in load to get miscellaneous host info from /proc…
2016-02-27 02:01:46 +09:00
Johan Walles 3232d34b24 Add test for process.CPUTimes() 2016-02-24 04:25:41 +01:00
Shirou WAKAYAMA 97bcc355a6 [process]linux: change to use exec.LookPath to invoke lsof. 2016-02-23 15:13:24 +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
Shirou WAKAYAMA e21c97d3b2 [process]darwin: forget to change as binary.go movement. 2016-02-12 23:53:53 +09:00
WAKAYAMA shirou 0af91ba32b [disk,process]freebsd: binary.go moved to internal. 2016-02-12 23:10:40 +09:00
Shirou WAKAYAMA 5a09d40f6b [process]darwin: expected ps file was changed. 2016-02-12 22:50:06 +09:00