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

55 Commits

Author SHA1 Message Date
shirou
a452de7c73 Merge pull request #346 from phemmer/rlimit-current
add current values to rlimit retrieval
2017-08-31 11:58:10 +09:00
Shirou WAKAYAMA
3aa2ffab12 [process] linux: fix NumFD type inconversion. 2017-08-04 03:09:34 +00:00
Conor Branagan
7b058c7436 Just look at filenames for linux NumFDs call.
In NumFDs we don't care about the contents of the fields, just how many
there are.
2017-08-02 13:49:55 -04:00
WAKAYAMA Shirou
5329f8ba79 [process] fix Document of CreatTime seconds -> milliseconds 2017-07-26 22:33:15 +09: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
Jorick Caberio
c432d48337 fix truncated process name of linux 2017-01-17 09:38:25 +08:00
Vyacheslav Kuznetsov
4de4e17f06 Added limit constants. Implemented function to parse process limits from /proc. 2017-01-11 00:04:05 +04:00
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
Nick Cabatoff
28640e5d73 fix incorrect names for fields in proc/pid/io 2016-07-24 11:19:59 -04: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
613a8a90e1 fixed by golint. 2016-04-01 21:34:39 +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
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
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
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 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
Ben Aldrich
faeb99d327 fix meminfo output on consecutive calls 2016-02-09 18:57:56 -07:00
Robert Weber
c804a9e755 Per suggestions 2016-02-08 09:26:35 -07:00
Robert Weber
4dcb099f3d no or 2016-02-04 15:15:29 -07:00
Robert Weber
6496b57b3d Need to promote this error 2016-02-04 15:14:11 -07:00
Shirou WAKAYAMA
d680853370 net,process[linux]: add process.NetIOCounter and net.NetIOCounterByFile. 2016-01-21 17:31:05 +09:00
Jimmi Dyson
7e4cef7a30 Handle process filenames with spaces in the name
Fixes #120
2015-12-07 09:27:07 +00:00
shirou
d49c4afc40 Merge pull request #96 from shirou/process/fix_openfiles
process[linux]: implements OpenFiles.
2015-11-24 09:54:43 +09:00
Shirou WAKAYAMA
dd13300833 process[linux,freebsd,darwin]: implements Children using pgrep. 2015-11-24 00:04:20 +09: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
Jonathan Chauncey
0461c50666 chore(*): Fixes #94
Added the ability to fetch an alternative location for /proc via an
environment variable. If the env var is not set it will return /proc as
the default value.
2015-10-17 11:34:41 -06:00
Shirou WAKAYAMA
42af4a3e60 process[linux]: implements OpenFiles. 2015-10-17 00:41:14 +09:00
andy
cf5660bfd3 process[linux]: calculate the CreateTime and then convert to microseconds 2015-09-28 16:18:53 +01:00
Shirou WAKAYAMA
b3cf7354f6 process[linux, darwin]: implements Connections using lsof. 2015-09-18 13:36:13 +09:00
Shirou WAKAYAMA
d6ac361a24 process[darwin,linux]: implements Parent using lsof. 2015-09-16 13:06:07 +09:00
Shirou WAKAYAMA
a00c5af817 process[linux]: return up-to-date information when invoked. 2015-09-11 15:54:10 +09:00
choplin
cc3a104593 Ensure that process.MemoryInfo returns a up-to-date value. 2015-09-11 13:47:03 +09:00
Shirou WAKAYAMA
a22c0c27d9 linux: fix ctime in linux. 2015-07-23 11:38:47 +09:00
Shirou WAKAYAMA
0921e1f153 [linux] Process.CreateTime was returned msec, not sec. 2015-06-19 12:05:07 +09:00
Nikolay Sivko
889c8c0bd5 enable Process.NumFds() for linux 2015-04-08 14:01:05 +03:00
Shirou WAKAYAMA
1f5fdd1fba process: user and system should be divide by ClockTicks directly. 2015-03-17 17:04:31 +09:00
Shirou WAKAYAMA
e39f17afd7 process: fix process status parsing. 2015-03-06 12:07:05 +09:00