Commit Graph

1424 Commits

Author SHA1 Message Date
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
Omar Polo 932f2f6049
Fix cpu stats when hw.smt is enabled
When hw.smt is enabled, and it's enabled by default from 6.4, the
number of cpus given by `runtime.NumCPU()` is half of the total: only
the cpuN with N = 0,2,4,... are used by the system. We need to detect
that and ask for the correct stats.
2019-03-16 12:26:03 +01: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
Omar Polo 12d92847cf
Get hw.ncpuonline without unix.SysctlUint32
unix.Sysctl always return an error when asking for hw.ncpuonline, so
revert to a direct unix.Syscall6 to get the cpu count.
2019-03-13 11:03:17 +01:00
Omar Polo c2c7893509
fix logic error + little refactor
Fix: get cptime of n-th cpu when `percpu` instead of the average.

While there, rearrange the last if statement to make the code a bit
more homogeneous.
2019-03-12 21:29:10 +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
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
JHE a08b926ce6 It could be another error than the "self/mountinfo" missing 2019-02-10 00:01:25 +08:00
JHE 06a21ae66a Fix some issue. 2019-02-07 00:01:51 +08:00
JHE a5cb715e64 if mountinfo not found, use mounts 2019-02-05 23:30:19 +08:00
JHE d141349619 if mountinfo not found, use mounts 2019-02-05 21:23:46 +08:00
JHE a45f6d8a03 if mountinfo not found, use mounts 2019-02-05 21:06:23 +08:00
shirou 0714469421
Merge pull request #593 from nvinzens/master
replace self/mounts with self/mountinfo
2019-02-01 00:11:21 +09:00
shirou 150e391450
Merge pull request #632 from shirou/add_freebsd_arm
add FreeBSD ARM support. copied from i386
2019-02-01 00:08:15 +09:00
Minje Park d23abede78 struct typo and broken test case were fixed 2019-01-31 00:31:43 +09:00
Minje Park d7ce61cac8 Error checks and fallback for old linux 2019-01-31 00:13:52 +09:00
Minje Park 9fb3b9625d mem available fallback under kernel 2.6.13 2019-01-30 21:58:44 +09:00
shirou 64d607539e add FreeBSD ARM support. copied from i386 2019-01-17 16:49:20 +09:00
shirou 7675aac4b0
Merge pull request #631 from shirou/add_created_time_on_windows_to_readme
add created_time on Windows to README
2019-01-15 10:39:27 +09:00
shirou 4a5a3cb6da add created_time on Windows to README 2019-01-15 10:01:35 +09:00
Nico Vinzens 1a7a39a789
Merge branch 'master' into master 2019-01-14 09:53:05 +01:00
shirou 457f04671d [process] move PageFaultsStat to process.go 2019-01-13 17:27:42 +09:00
shirou 98c84ed30a [process]: move HWM to MemoryInfo
at least FreeBSD and Darwin has HWM.
2019-01-13 17:23:01 +09:00
shirou a33a26bd97
Merge pull request #567 from tagirb/grouped_memorymaps
implement grouped memorymaps output
2019-01-13 17:17:11 +09:00
shirou 48b37fa45e
Merge pull request #616 from nefeli/linux_page_faults
[process][linux] Export process page fault info
2019-01-13 16:56:41 +09:00
shirou d94da856e5
Merge pull request #624 from ajacoutot/cpu-openbsd
cpu: implement Mhz and Cores on OpenBSD
2019-01-13 16:53:29 +09:00
shirou faf242fefc
Merge pull request #625 from wcc526/patch-1
Add VmHWM
2019-01-13 16:51:21 +09:00
Minje Park 73545ec820 AvailableMemory is't calculated automatically under kenel 3.14 so it is needed to calcuate manually
manual available memory calculation should be done if only memavail is false

Manual Available Memory calculation under kernel 3.14

accurate manaul available memory calculation
2019-01-06 23:21:59 +09:00
chi-chi weng ec5a8b2a50
Add VmHWM
VmHWM: Peak resident set size ("high water mark").

http://man7.org/linux/man-pages/man5/proc.5.html
2019-01-04 17:31:43 +08:00
Antoine Jacoutot 67297c8791 cpu: prefer cpuonline on OpenBSD
This gives us the value of actual online CPUs (as opposed to the
found ones which may not be able active).
2019-01-02 17:10:02 +01:00