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

1297 Commits

Author SHA1 Message Date
Tyler Dixon
a02925055c Remove cycle between process and host packages
gopsutil is a transitive dependency of another project that I am integrating
into an internal build system. We target multiple platforms and as a part
of the build system for the large internal repo, we calculate the build
graph used to determine what targets have changed and need to be build /
tested as a single DAG for all platforms.

gopsutil currently does not form a DAG if linux and any other platform are
considered at the same time. linux is the only platform where the process
package imports the host package.

To remove this cycle, the relevant methods have been moved to internal/common
with the linux build tag and are consumed the host and process packages.
2019-05-22 17:45:50 -07:00
shirou
e146c2e08a
Merge pull request #677 from shirou/feature/remove_stolen_from_cpu
[cpu]: remove unused field Stolen
2019-05-12 18:43:21 +09:00
shirou
3e23fdab39
Merge pull request #684 from Lomanic/issue670
[process][darwin] Fix #670 remove call to common.Pipeline (prone to race condition)
2019-05-12 18:15:54 +09:00
Lomanic
0e0dd767df [process][darwin] Fix #670 remove call to common.Pipeline (prone to race condition)
Also properly parse lsof to get second txt record instead of hoping the 5th line is the right one (wrong data returned for pid 57)
2019-05-08 18:17:56 +02:00
shirou
1b7d8ed295
Merge pull request #683 from Segflow/master
Fix: use filename in exec.LookPath instead of full path
2019-05-06 08:34:57 +09:00
Segflow
86c7289ccc Fix: use filename in exec.LookPath instead of full path
exec.LookPath searches for the file in the $PATH, which mean giving it an absolute path is against it's own purposes.
2019-05-05 20:45:07 +01:00
shirou
01487156ff
Merge pull request #682 from pytimer/add-load-procstotal
add ProcsTotal in load
2019-05-05 21:37:46 +09:00
pytimer
9715668586 add ProcsTotal in load 2019-05-05 10:29:20 +08:00
shirou
cae8efcffa [cpu]: remove unused field Stolen
see #676
2019-04-27 13:45:12 +09:00
shirou
fa9845945e
Merge pull request #674 from lootek/more-vmstat
Add pages in/out/fault statistics (as read from vmstat)
v2.19.04
2019-04-27 12:13:43 +09:00
lootek
1cbb212a6b
Add pages in/out/fault statistics (as read from vmstat) 2019-04-25 09:32:59 +02:00
shirou
2cbc9195c8
Merge pull request #659 from mingrammer/gofmt
Refactor with gofmt
v2.19.03
2019-03-23 22:16:28 +09:00
mingrammer
64a995aad4 Refactor with gofmt 2019-03-23 21:57:24 +09:00
shirou
68c6fbd367
Merge pull request #651 from mingrammer/go-modules
Support go modules
2019-03-23 10:02:08 +09:00
shirou
b2eb6640fb [disk][windows]: does not define ret at begining of the function.
To reduce memory when error happend. commented on #653.
2019-03-23 09:48:18 +09:00
shirou
2689fdca83
Merge pull request #655 from keefo/fix_654
[Darwin][process]Add hour handling in convertCPUTimes function
2019-03-23 09:42:38 +09:00
shirou
e1d4d987e0
Merge pull request #650 from mznet/physical-cpu-darwin
[Darwin][CPU] retrieve a cpu count depends on an boolean argument
2019-03-23 09:39:50 +09:00
Liam Xu
1b525b7c9c Return cpu time format error
Return cpu time format error
2019-03-22 11:44:52 -07:00
Liam Xu
f2f18df9db Use Swith to replace if else
Use Swith to replace if else
2019-03-22 10:21:01 -07:00
Minje Park
caebe5dbe4 returning 0 and error if SysctlUint32 raises an error 2019-03-21 23:52:34 +09:00
Xu Lian
6eb4d73bde Fix an indentation issues 2019-03-18 20:36:12 -07:00
Liam Xu
b3670f8027 Add hour handling in convertCPUTimes function
This commit add hour handling in convertCPUTimes function.

The time string usually comes from macOS command line:
ps -a -o stime,utime -p <pid>

which could contain hour string.
2019-03-18 15:48:08 -07:00
Lomanic
381f7cc0bf
Merge pull request #652 from mingrammer/fix-misspells
Fix typos
2019-03-18 12:30:02 +01:00
mingrammer
017c9f9cbc Fix typos 2019-03-18 02:52:26 +09:00
mingrammer
ca89e7d77e Support go modules 2019-03-18 02:45:14 +09:00
Minje Park
ca1fcad2aa retrieve a cpu count depends on an boolean argument 2019-03-17 23:18:29 +09:00
shirou
533485542f
Merge pull request #649 from shirou/feature/fix_648_freebsd_mem
[mem][freebsd]: add SysctlUint which can adapt both 32 and 64 bit
2019-03-17 09:16:13 +09:00
WAKAYAMA shirou
bb15c85289 [mem][freebsd]: add SysctlUint which can adapt both 32 and 64 bit 2019-03-16 21:43:15 +09:00
Lomanic
ebc97eefea
Merge pull request #644 from Lomanic/issue640
[cpu][linux] Add support for logical arg in Counts #640 #628
2019-03-13 18:43:15 +01:00
Lomanic
200e5fbeab [cpu][linux] Remove regexp in Counts
Also remove some remaining debug print and unnecessary strings.Split
2019-03-06 19:41:26 +01:00
Lomanic
c0ca431bf1 [cpu][linux] Add support for logical arg in Counts #640 #628 2019-03-03 14:44:21 +01:00
Lomanic
27ec6a0789 [host][linux] Remove call to sysctl binary in host/host_linux.go #639 2019-03-02 23:22:53 +01:00
Lomanic
7e9e36b568 [host][openbsd] Remove calls to sysctl binary in host/host_openbsd.go #639 2019-03-02 23:22:53 +01:00
Lomanic
e3c878cc43 [mem][darwin] Remove calls to sysctl binary in mem/mem_darwin.go #639 2019-03-02 23:22:53 +01:00
Lomanic
d110536e10 [host][darwin] Remove calls to sysctl binary in host/host_darwin.go #639 2019-03-02 23:22:53 +01:00
Lomanic
974d52d412 [load][darwin] Remove calls to sysctl binary in load/load_darwin.go #639
Again, a simple benchmark:

Lomanics-iMac:~ lomanic$ time ./load_avg.old ; time ./load_avg
{load1:0.89,load5:0.99,load15:1.01} <nil>

real    0m0.019s
user    0m0.008s
sys     0m0.013s
{load1:0.8876953125,load5:0.98828125,load15:1.0146484375} <nil>

real    0m0.011s
user    0m0.004s
sys     0m0.006s

This is faster and yields more precise results.
2019-03-02 23:22:53 +01:00
Lomanic
2ec35609d2 [cpu][darwin] Remove calls to sysctl binary in cpu/cpu_darwin.go #639
Empirical benchmark (calling to cpu.Info):

Lomanics-iMac:~ lomanic$ time ./cpu_info
info 0: {"cpu":0,"vendorId":"GenuineIntel","family":"6","model":"30","stepping":5,"physicalId":"","coreId":"","cores":2,"modelName":"Intel(R) Core(TM) i5-6440HQ CPU @ 2.60GHz","mhz":2590,"cacheSize":256,"flags":["syscall","xd","em64t","lahf","lzcnt","prefetchw","rdtscp","tsci","fpu","vme","de","pse","tsc","msr","pae","mce","cx8","apic","sep","mtrr","pge","mca","cmov","pat","pse36","clfsh","mmx","fxsr","sse","sse2","htt","sse3","ssse3","cx16","sse4.1","sse4.2","popcnt","vmm"],"microcode":""}

real    0m0.049s
user    0m0.023s
sys     0m0.041s
Lomanics-iMac:~ lomanic$ time ./cpu_info.fixed
info 0: {"cpu":0,"vendorId":"GenuineIntel","family":"6","model":"30","stepping":5,"physicalId":"","coreId":"","cores":2,"modelName":"Intel(R) Core(TM) i5-6440HQ CPU @ 2.60GHz","mhz":2590,"cacheSize":256,"flags":["fpu","vme","de","pse","tsc","msr","pae","mce","cx8","apic","sep","mtrr","pge","mca","cmov","pat","pse36","clfsh","mmx","fxsr","sse","sse2","htt","sse3","ssse3","cx16","sse4.1","sse4.2","popcnt","vmm","syscall","xd","em64t","lahf","lzcnt","prefetchw","rdtscp","tsci"],"microcode":""}

real    0m0.010s
user    0m0.004s
sys     0m0.006s
2019-03-02 23:22:53 +01:00
shirou
6c6abd6d16
Merge pull request #626 from mznet/manual-available-memory-calculation
Manual available memory calculation
v2.19.02
2019-03-01 22:30:41 +09:00
shirou
41128a19e8
Merge pull request #641 from nikita-vanyasin/eliminate-wmi-queries-for-cpu-usage
Eliminate WMI queries when calling cpu.Times with percpu=True
2019-02-25 22:04:32 +09:00
Lomanic
41e774419f
Merge pull request #643 from wcc526/master
Update process_linux.go for Add process ConnectionsMax
2019-02-23 21:23:09 +01:00
wcc526
462e0f6c2f Update process_linux.go for Add process ConnectionsMax 2019-02-23 18:55:31 +08:00
Lomanic
368a865910 [disk][linux] Fix comment in PartitionsWithContext 2019-02-22 19:41:13 +01:00
Lomanic
0d3a2ac515
[disk][linux] Fix comment in PartitionsWithContext 2019-02-22 19:31:08 +01:00
Lomanic
b67304da73
Merge pull request #634 from qaz52897/support_old_kernel
Support Linux kernels without /proc/self/mountinfo (<2.6.26)
2019-02-22 19:28:43 +01:00
nikita-vanyasin
59b002e5c2 Fix function naming 2019-02-22 11:19:56 +03:00
nikita-vanyasin
4ef0ddafc7 Eliminate WMI queries when calling cpu.Times with percpu=True
based on e89f2c5fad/internal/monitors/cpu/cpu_windows.go
2019-02-22 09:51:24 +03:00
shirou
9294781cc9
Merge pull request #636 from shirou/feature/update_xswdev_version_freebsd_12
[mem]freebsd: update xswdev_version to adapt FreeBSD 12.
2019-02-16 01:14:15 +09:00
Minje Park
c75deb9dc0 debug codes were removed 2019-02-13 01:02:18 +09:00
Minje Park
47ed6aaebd activefile and inactivefile fields were removed from VirtualMemoryStat 2019-02-13 00:55:05 +09:00
shirou
b3d992b0f6 [mem]freebsd: update xswdev_version to adapt FreeBSD 12. 2019-02-10 23:19:06 +09:00