1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-05-10 19:29:14 +08:00

617 Commits

Author SHA1 Message Date
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
70ba28090d add version 2 breaking change notification to README. 2016-03-22 21:51:43 +09:00
Shirou WAKAYAMA
1f32ce1bb3 [net]linux: skip if "/proc/sys/net" is not exists on test environment. 2016-03-15 22:47:56 +09:00
Shirou WAKAYAMA
fa3e1cc196 [common]linux: add HostEtc to switch '/etc' See #175. 2016-03-13 23:42:06 +09:00
shirou
4dfd293fa8 Merge pull request #169 from shirou/net/replace_lsof
[net]linux: start replacing lsof
2016-03-12 23:47:39 +09:00
Shirou WAKAYAMA
34b63e671b [net]linux: add a test and fix private field name. 2016-03-10 22:32:16 +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
567da004c5 [net]linux: explicit skip CI. 2016-03-06 00:02:06 +09:00
Shirou WAKAYAMA
32fa88eb49 [net]linux: TestGetProcInodes will fail on CI. 2016-03-05 23:57:18 +09:00
Shirou WAKAYAMA
31439aa6b5 [net]linux: fix valious bugs in NetConnections. 2016-03-05 23:53:32 +09:00
Shirou WAKAYAMA
e4ddff09d5 [net]linux: add process_unix for NetConnections. 2016-03-05 22:24:26 +09:00
Shirou WAKAYAMA
32c62b5d48 [net]linux: implement processInet(). 2016-03-04 23:42:22 +09:00
Shirou WAKAYAMA
715c421b57 [process]: add OpenFiles() test. 2016-03-04 09:42:40 +09:00
shirou
24e2746d13 Merge pull request #171 from raviparimi/make-slice-errors
Provide correct length for slice creation.
2016-03-04 09:34:04 +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
shirou
a0cf924cac Merge pull request #170 from vecmezoni/fd-close
NewProcess does not close file descriptor
2016-03-03 09:48:12 +09:00
Alexander Inozemtsev
f4902fae49 Properly close opened file 2016-03-02 18:19:52 +03:00
Shirou WAKAYAMA
6c352016d8 [net]linux: start replacing lsof. still work in progress. 2016-03-01 23:38:13 +09: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
shirou
d6702c96bd Merge pull request #168 from cgilling/faster_linux_new_process
process: change linux NewProcess to only stat /proc/[pid]
2016-02-29 10:09:30 +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
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
shirou
cfe7e5f1ca Merge pull request #163 from walles/walles/test_proc_cputimes
Add test for process.CPUTimes()
2016-02-24 17:23:41 +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
shirou
1d09f7a4e9 Merge pull request #160 from walles/walles/vmtest
Document + add tests for for mem.VirtualMemory()
2016-02-22 15:56:05 +09:00
Johan Walles
dd875d4970 Fix memory stats on Darwin, non-CGO 2016-02-22 07:29:15 +01:00
Johan Walles
d109284df3 Fix memory stats on Darwin, CGO 2016-02-22 07:28:55 +01:00
Johan Walles
27093ae2d2 mem_darwin_test.go: Compare total to sysctl hw.memsize 2016-02-22 07:28:55 +01:00
Johan Walles
0d5592714b Fix memory stats on LinuxFreeBSD 2016-02-22 07:28:44 +01:00
Johan Walles
66a07939f7 Fix memory stats on Linux 2016-02-21 20:56:11 +01:00
Johan Walles
4438159155 Document + add tests for for mem.VirtualMemory()
This change changes and documents the (previously undocumented) behavior of Used
to "RAM used by programs".

We also remove the undocumented and unused Shared field of that struct.

So with this change in place, the VirtualMemoryStruct contains:
* three human-consumable fields for Total, Used and Available memory
* one human-consumable UsedPercentage field
* a number of kernel specific fields
2016-02-21 20:56:11 +01:00
shirou
e04a02d2d7 Merge pull request #161 from walles/walles/darwin-vmperf
Use OS calls rather than exec() to get memory stats on Darwin
2016-02-21 22:06:43 +09:00
Johan Walles
44f817eb8d Split mem_darwin.go into CGO and non CGO variants 2016-02-20 21:49:23 +01:00
Shirou WAKAYAMA
821a0141b1 [load]: add comments. 2016-02-20 23:17:20 +09:00
Shirou WAKAYAMA
c973fdbc46 [load]linux: fix compile problems. 2016-02-20 23:03:32 +09:00
Shirou WAKAYAMA
f9effa497e [load]all: add Misc in load to get miscellaneous host info from /proc/stat 2016-02-20 22:52:16 +09:00
Johan Walles
00504a37e3 Remove unused import 2016-02-19 23:39:00 +01:00
Johan Walles
a6cd6f803b Use Go's built in syscall.Getpagesize() 2016-02-19 23:37:43 +01:00
Johan Walles
13e00c76e4 Use OS calls rather than exec() to get memory statistics
Before this change we used to exec() various binaries to find out memory
information.

While this worked, it was awfully slow.

And if somebody would want to compute how many percent of available memory all
PIDs on the system uses, that would take almost ten seconds on my laptop with
the previous implementation.

This implementation fares a lot better, and is smaller.
2016-02-19 21:28:50 +01:00
Johan Walles
5771ea9465 Add Darwin specific mem.VirtualMemory() tests 2016-02-19 20:53:29 +01:00
Shirou WAKAYAMA
3166d41538 set LC_ALL to C in order to avoid number formatting problem. 2016-02-17 16:29:35 +09:00
shirou
79f021f66e Merge pull request #158 from walles/walles/darwin-memorypercent
process: Implement MemoryPercent() for Darwin
2016-02-17 12:18:26 +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
956f92742f Merge pull request #156 from shirou/add_build_check
Add build check
2016-02-13 00:04:49 +09:00