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

172 Commits

Author SHA1 Message Date
Lomanic
4cfc60d68b
Merge pull request #928 from Lomanic/skip-tests-when-not-implemented 2020-09-06 13:33:31 +02:00
ninedraft
34df4904f6 use cancelable sleep in cpu.PercentWithContext and process.Process.PercentWithContext 2020-09-03 23:01:53 +03:00
Tobias Klauser
548c500117 Use unix.SysctlUin32("hw.ncpuonline") on OpenBSD
Use SysctlUvmexp from golang.org/x/sys/unix to avoid having to simplify
the implementation of cpu.InfoWithContext

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-09-01 11:22:28 +02:00
Lomanic
38f6ed0e0c [cpu] Skip tests on non-implemented platforms #446 2020-08-29 18:29:04 +02:00
Guillaume Ballet
baec973ff6 Fix stepping extraction 2020-06-22 13:03:18 +02:00
Guillaume Ballet
877e0a6603 more typo fixes 2020-06-22 11:59:22 +02:00
Guillaume Ballet
8968457048 fix typo 2020-06-22 11:56:02 +02:00
Guillaume Ballet
771601b292 use sysctl instead of parsing dmesg output 2020-06-22 11:54:44 +02:00
Guillaume Ballet
9390667f0f
Update cpu/cpu_dragonfly.go
Co-authored-by: shirou <shirou.faw@gmail.com>
2020-06-21 12:21:18 +02:00
Guillaume Ballet
56d9e0b7be cpu: support for DragonflyBSD 2020-06-18 10:17:23 +02:00
Lomanic
663af789c0
Merge pull request #872 from renaynay/update-docs-cputimes
Update docs for TimesStat with correct time unit
2020-05-31 17:11:28 +02:00
Lomanic
a901d160ca
Merge pull request #870 from renaynay/naming-consistency
Renamed variables storing `CLK_TCK` value for consistency across OSs
2020-05-31 17:01:13 +02:00
renaynay
5e1b882e37
updated docs for TimesStat with correct time unit 2020-05-13 11:21:01 +02:00
renaynay
0e9462eed2
renamed CLK_TCK variables for consistency across OSs 2020-05-12 15:36:18 +02:00
renaynay
d4985c9690
added check for CLK_TCK 2020-05-12 13:59:26 +02:00
Dmitri Goutnik
270f6afc22
Add support for freebsd/arm64 2019-12-17 03:12:29 -05:00
shirou
b0025409e9 [cpu][linux]: add cpuinfo parse check. 2019-11-14 21:47:42 +09:00
alialaee
b8f51de8f6 Fix #777 cpu.Total should not add Guest and GuestNice 2019-10-15 19:19:12 +03:30
shirou
e4d2c2f87a
Merge pull request #749 from Lomanic/issue628windows
[cpu][windows] Add support for logical arg in Counts #640 #628
2019-08-16 09:34:56 +09:00
Lomanic
71adb75383 [cpu][windows] Add support for logical arg in Counts #640 #628 2019-08-14 23:52:41 +02:00
Lomanic
e6aa38bec2 [cpu][windows] WIP Add support for logical arg in Counts #640 #628 2019-08-14 23:35:31 +02:00
shirou
86fdae99e1 [cpu]: return 100 instead 1 if t1 are bigger than t2 2019-07-06 11:24:35 +09:00
Lomanic
946c9ce6ea [cpu] Fix #599 cap percent values returned by Percent() between 0 and 100
See https://github.com/shirou/gopsutil/issues/599#issuecomment-491942842 for a repoduction case
2019-06-23 16:14:27 +02:00
Lomanic
35f21af98a
Merge pull request #699 from harpchad/solaris_cpu
Add support fo Solaris cpu times (idle, sys, user, iowait) in cpu_solaris
2019-06-08 19:53:38 +02:00
Chad Harp
8c6072d111 Cast bytes to string 2019-06-07 07:39:57 -05:00
Chad Harp
16b37cc9c2 Modify cpu_solaris to support Sorlais 10 2019-06-02 09:58:35 -05:00
Chad Harp
354718bdd8 Add support for Solaris CPU times 2019-06-01 15:05:46 -05:00
shirou
4b629897d2
Merge pull request #647 from omar-polo/master
[OpenBSD][CPU] fix per-cpu
2019-06-01 10:24:59 +09: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
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
Omar Polo
3cbb0873de
int32 is enough -- don't waste space 2019-05-02 12:24:16 +02:00
shirou
cae8efcffa [cpu]: remove unused field Stolen
see #676
2019-04-27 13:45:12 +09:00
Minje Park
caebe5dbe4 returning 0 and error if SysctlUint32 raises an error 2019-03-21 23:52:34 +09:00
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
2019-03-19 20:06:12 +01:00
Omar Polo
c28fe78291
forget to take addr 2019-03-18 19:58:50 +01:00
Minje Park
ca1fcad2aa retrieve a cpu count depends on an boolean argument 2019-03-17 23:18:29 +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
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
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
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
64d607539e add FreeBSD ARM support. copied from i386 2019-01-17 16:49:20 +09: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
Antoine Jacoutot
7276e963eb cpu: implement Mhz and Cores
Adapted from the FreeBSD code.
Successfully tested with Nomad.
2019-01-02 17:06:46 +01:00
Lomanic
5f8353c741 [cpu][openbsd] Fix #621, define CPU states according to OpenBSD version 2018-12-29 15:24:52 +01:00
marcospedreiro
f0ebb60b86 handle pr comments: use assert.InEpsilon 2018-11-20 13:25:17 -08:00
marcospedreiro
d47801b68b revert imports 2018-11-19 22:06:05 -08:00