Commit Graph

1446 Commits (71ddd2ac23fe3233667c96a24722fe67d82e733e)
 

Author SHA1 Message Date
Omar Polo 3cbb0873de
int32 is enough -- don't waste space 6 years ago
shirou cae8efcffa [cpu]: remove unused field Stolen
see #676
6 years ago
shirou fa9845945e
Merge pull request #674 from lootek/more-vmstat
Add pages in/out/fault statistics (as read from vmstat)
6 years ago
Marc 174b31f146 Fix for #665
Remains backward compatible.

When encountering non-fatal errors SensorsTemperatures() returns the
temperatures for all the sensor we could read successfully. In that
case the custom error contains a list of all the non-fatal errors
encountered.

Example usage:

	_, err := SensorsTemperatures()
	if err != nil {
		warns, ok := err.(*Warnings)
		if ok {
			fmt.Printf("%v\n", err)
			for i, w := range warns.List {
				fmt.Printf("Warning %v: %v\n", i+1, w)
			}
		} else {
			t.Errorf("%v", err)
		}
	}
6 years ago
lootek 1cbb212a6b
Add pages in/out/fault statistics (as read from vmstat) 6 years ago
shirou 2cbc9195c8
Merge pull request #659 from mingrammer/gofmt
Refactor with gofmt
6 years ago
mingrammer 64a995aad4 Refactor with gofmt 6 years ago
shirou 68c6fbd367
Merge pull request #651 from mingrammer/go-modules
Support go modules
6 years ago
shirou b2eb6640fb [disk][windows]: does not define ret at begining of the function.
To reduce memory when error happend. commented on #653.
6 years ago
shirou 2689fdca83
Merge pull request #655 from keefo/fix_654
[Darwin][process]Add hour handling in convertCPUTimes function
6 years ago
shirou e1d4d987e0
Merge pull request #650 from mznet/physical-cpu-darwin
[Darwin][CPU] retrieve a cpu count depends on an boolean argument
6 years ago
Liam Xu 1b525b7c9c Return cpu time format error
Return cpu time format error
6 years ago
Liam Xu f2f18df9db Use Swith to replace if else
Use Swith to replace if else
6 years ago
Minje Park caebe5dbe4 returning 0 and error if SysctlUint32 raises an error 6 years ago
Omar Polo 53ce014b14
handle EOPNOTSUPP when checking for hw.smt
if hw.smt is not applicable for the current platform (e.g. i386),
pretend it's enabled
6 years ago
Xu Lian 6eb4d73bde Fix an indentation issues 6 years ago
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.
6 years ago
Omar Polo c28fe78291
forget to take addr 6 years ago
Lomanic 381f7cc0bf
Merge pull request #652 from mingrammer/fix-misspells
Fix typos
6 years ago
mingrammer 017c9f9cbc Fix typos 6 years ago
mingrammer ca89e7d77e Support go modules 6 years ago
Minje Park ca1fcad2aa retrieve a cpu count depends on an boolean argument 6 years ago
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
6 years ago
WAKAYAMA shirou bb15c85289 [mem][freebsd]: add SysctlUint which can adapt both 32 and 64 bit 6 years ago
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.
6 years ago
Lomanic ebc97eefea
Merge pull request #644 from Lomanic/issue640
[cpu][linux] Add support for logical arg in Counts #640 #628
6 years ago
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.
6 years ago
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.
6 years ago
Lomanic 200e5fbeab [cpu][linux] Remove regexp in Counts
Also remove some remaining debug print and unnecessary strings.Split
6 years ago
Lomanic c0ca431bf1 [cpu][linux] Add support for logical arg in Counts #640 #628 6 years ago
Lomanic 27ec6a0789 [host][linux] Remove call to sysctl binary in host/host_linux.go #639 6 years ago
Lomanic 7e9e36b568 [host][openbsd] Remove calls to sysctl binary in host/host_openbsd.go #639 6 years ago
Lomanic e3c878cc43 [mem][darwin] Remove calls to sysctl binary in mem/mem_darwin.go #639 6 years ago
Lomanic d110536e10 [host][darwin] Remove calls to sysctl binary in host/host_darwin.go #639 6 years ago
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.
6 years ago
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
6 years ago
shirou 6c6abd6d16
Merge pull request #626 from mznet/manual-available-memory-calculation
Manual available memory calculation
6 years ago
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
6 years ago
Lomanic 41e774419f
Merge pull request #643 from wcc526/master
Update process_linux.go for Add process ConnectionsMax
6 years ago
wcc526 462e0f6c2f Update process_linux.go for Add process ConnectionsMax 6 years ago
Lomanic 368a865910 [disk][linux] Fix comment in PartitionsWithContext 6 years ago
Lomanic 0d3a2ac515
[disk][linux] Fix comment in PartitionsWithContext 6 years ago
Lomanic b67304da73
Merge pull request #634 from qaz52897/support_old_kernel
Support Linux kernels without /proc/self/mountinfo (<2.6.26)
6 years ago
nikita-vanyasin 59b002e5c2 Fix function naming 6 years ago
nikita-vanyasin 4ef0ddafc7 Eliminate WMI queries when calling cpu.Times with percpu=True
based on e89f2c5fad/internal/monitors/cpu/cpu_windows.go
6 years ago
shirou 9294781cc9
Merge pull request #636 from shirou/feature/update_xswdev_version_freebsd_12
[mem]freebsd: update xswdev_version to adapt FreeBSD 12.
6 years ago
Minje Park c75deb9dc0 debug codes were removed 6 years ago
Minje Park 47ed6aaebd activefile and inactivefile fields were removed from VirtualMemoryStat 6 years ago
shirou b3d992b0f6 [mem]freebsd: update xswdev_version to adapt FreeBSD 12. 6 years ago
JHE a08b926ce6 It could be another error than the "self/mountinfo" missing 6 years ago