Commit Graph

33 Commits

Author SHA1 Message Date
shirou d1cc7d2125 fix(cpu): fix cpu total and busy calc 2022-07-09 02:13:44 +00:00
Matthieu MOREL 8ba220d241 enable contextcheck linter 2022-01-24 09:26:50 +01:00
mmorel-35 1e6b445a8a gofumpt 2021-12-22 21:54:41 +00:00
shirou 0969c9436b delete v2 directory, move v3 to top #1078 2021-11-30 23:47:59 +00:00
ninedraft 34df4904f6 use cancelable sleep in cpu.PercentWithContext and process.Process.PercentWithContext 2020-09-03 23:01:53 +03:00
renaynay 5e1b882e37
updated docs for TimesStat with correct time unit 2020-05-13 11:21:01 +02:00
alialaee b8f51de8f6 Fix #777 cpu.Total should not add Guest and GuestNice 2019-10-15 19:19:12 +03:30
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
shirou cae8efcffa [cpu]: remove unused field Stolen
see #676
2019-04-27 13:45:12 +09:00
Lomanic c0ca431bf1 [cpu][linux] Add support for logical arg in Counts #640 #628 2019-03-03 14:44:21 +01:00
Laurie Clark-Michalek 413cb32b6c Use static initialisation for invoke instances, instead of init funcs
The order of init function execution is dependant on the order that the
source files are passed to the compiler. This causes issues when
building under other build systems, such as bazel or buck, as they are
not guarenteed to maintain the same file order as the default go tool.
2018-03-21 14:08:39 +00:00
shirou 4c73494c78 Add WithContext functions. 2017-12-31 15:25:49 +09:00
Adam Medzinski 22f3299fd7
Add missing doc for cpu.TimesStat structure 2017-11-27 12:17:18 +01:00
Jakob Gillich facb241c12 clarify return value of cpu.Percent() 2017-03-31 16:07:44 +02:00
WAKAYAMA Shirou f8ef680a47 error strings change to lowercase 2017-03-15 22:43:20 +09:00
Simarpreet Singh 5a4c90ad5f cpu: Expose CPU microcode information
This commit exposes the CPU microcode information.

Signed-off-by: Simarpreet Singh <simar@opendns.com>
2017-03-07 16:18:20 -08:00
Hilko Bengen 832dcb96c8 cpu.Percent (Windows): Use the same implementation as on Unix
WMI is way too slow.
2016-09-27 18:15:05 +02:00
Ben Aldrich a76195e088 fixed imports and spelling error 2016-06-01 15:53:54 -06:00
Ben Aldrich c36f7ac8b0 rename var 2016-06-01 15:45:29 -06:00
Ben Aldrich fcc1747d9f Merge branch 'master' of https://github.com/shirou/gopsutil into calc_cpu_percent
Conflicts:
	cpu/cpu.go
2016-06-01 15:24:23 -06:00
Ben Aldrich c389989453 calculate cpu percentage compared to last call if 0 interval is given 2016-06-01 15:21:58 -06:00
Shirou WAKAYAMA 57f6aebc7e add Timeout to invoke command and use common.Invoke refs: #201 2016-05-20 17:59:41 +09:00
Shirou WAKAYAMA 4bb84648bf JSON representation is renamed to fit Google JSON style, camelCase. 2016-03-23 10:52:46 +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
Johan Walles ebaa641e63 Make a public function for computing total CPU time
This function used to be a private part of process.go.

Since I needed that functionality however I think it's better to make it public
than for me to copy it into my own code.

As a side effect of this change, I also fixed a bug in the function where Stolen
was not part of the sum. Having the function close to the CPUTimesStat
declaration will make problems like this less likely to re-occur in the future.
2016-02-10 17:53:39 +01:00
Ryan J. O'Neil 2434a327b9 Removing race condition in CPUPercent calculation. 2015-12-15 15:22:30 -05:00
WAKAYAMA Shirou ead8393137 cpu: use wmic to get CPU usage on Windows. 2015-03-11 23:00:06 +09:00
Shirou WAKAYAMA 753ea1bb48 fix when converting CPUTimes to JSON, sometimes idel have exponent 2015-02-13 23:11:27 +09:00
Shirou WAKAYAMA 4b5bf22b88 change CPUTimes type from float32 to float64 to resolve precision issue. 2015-02-13 22:45:12 +09:00
Shirou WAKAYAMA 13cd195a7e change package name. 2014-12-30 22:09:05 +09:00
Shirou WAKAYAMA 16de570414 merge 039b9defab 2014-12-27 23:42:00 +09:00
Shirou WAKAYAMA a4671fcc2a move subdirectories. refer to issue #24 2014-11-27 10:18:15 +09:00