shirou
bc060cc227
add SPDX License, remove old build tag, and replace import
2024-05-28 22:27:17 +09:00
Jan De Dobbeleer
a1eedcae8e
fix(linux): validate cpu fields length before accessing index
2023-10-30 08:35:46 +01:00
Kishen V
63e0b63ab8
Enable setting of vendor and related information for all Power versions
2023-07-25 09:59:38 +05:30
Antoine Toulme
38b94668ea
allow to pass context values to override environment variables
2023-06-02 01:31:05 -07:00
Matthieu MOREL
1fb1e3e3e6
ci(lint): correct gci linter
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-04-04 18:07:22 +00:00
shirou
f78f9a6bb8
Merge pull request #1414 from jeffweiss/bugfix/get_tests_working_on_s390x
...
get tests passing on s390x
2023-02-12 18:58:26 +09:00
Jeff Weiss
f850a69ba1
get tests passing on s390x
2023-02-07 14:12:31 -08:00
Guoqi Chen
b055174e9e
cpu: Add the matching rule "Model Name" when parsing cpuinfo
...
This is to fix the error of running TestCpuInfo on Linux/long64. In loong64
/proc/cpuinfo, the model name is capitalize the first letter
Reference:
https://github.com/torvalds/linux/blob/master/arch/loongarch/kernel/proc.c
Signed-off-by: Guoqi Chen <chenguoqi@loongson.cn>
2023-01-14 07:05:49 +08:00
sgthammer
83256398be
fill modelName for all cores in arm64 devices
2022-12-06 14:56:51 +03:00
Yalcin Ozbek
8bf7f37fca
the code has been moved before append
...
Signed-off-by: Yalcin Ozbek <yalcinozbekceng@gmail.com>
2022-11-05 16:40:39 +03:00
Yalcin Ozbek
4314a0567b
the code has been moved outside the loop.
...
Signed-off-by: Yalcin Ozbek <yalcinozbekceng@gmail.com>
2022-11-05 16:37:04 +03:00
Yalcin Ozbek
13f00fde46
code review fix
...
Signed-off-by: Yalcin Ozbek <yalcinozbekceng@gmail.com>
2022-11-05 15:06:30 +03:00
Yalcin Ozbek
102439862e
feat: Setting the model name for arm based CPUs
...
- Added arm model and model name as map.
- The modelName is set again according to the model value when the model name is empty.
- Based on lscpu source code.. https://github.com/util-linux/util-linux/blob/master/sys-utils/lscpu-arm.c
---
Signed-off-by: Yalcin Ozbek <yalcinozbekceng@gmail.com>
2022-11-05 02:36:48 +03:00
mmorel-35
1e6b445a8a
gofumpt
2021-12-22 21:54:41 +00:00
Matthieu MOREL
c8fd8c7b1f
enable unparam linter
2021-12-22 19:53:14 +01:00
shirou
d2e27c1712
fix dependabot v2 deletion.
2021-12-01 00:12:55 +00:00
shirou
0969c9436b
delete v2 directory, move v3 to top #1078
2021-11-30 23:47:59 +00:00
Ville Skyttä
47f2f0eee5
[cpu][linux] add more ARM hw implementers
2021-05-30 15:39:19 +03:00
Ville Skyttä
b8ac60acc1
[cpu][linux] more info for ARM processors
...
https://developer.arm.com/documentation/ddi0337/h/system-control/register-descriptions/cpuid-base-register--cpuid
2021-05-20 19:35:01 +03:00
Lomanic
6589c5c274
[cpu][linux] Fix #1037 only count logical cores where 2nd field is a number
2021-02-22 00:28:56 +01:00
Tobias Klauser
ee12f66e4d
cpu, v3/cpu: use sysconf package instead of exec'ing getconf
...
Currently, ClocksPerSec is determined by exec'ing getconf in func init,
i.e. on startup of every program importing the package. getconf might
not be present on some systems or is not executable by the current user.
To avoid this hard to control dependency, use the
github.com/tklauser/go-sysconf package which implements sysconf(3)
entirely in Go without cgo. The package is supported on all platforms
currently supported by the cpu and v3/cpu package of gopsutil.
2021-02-19 12:20:10 +01:00
Lomanic
976679ee00
[cpu][linux] Get logical cores in Counts() with non-deprecated kernel API first
...
Implementing https://github.com/giampaolo/psutil/pull/1727#issuecomment-707624964
and bfae1fc4a3
2020-11-07 00:48:53 +01:00
Lomanic
7700262175
[cpu][linux] Fix #849 implement giampaolo/psutil#1727 in Counts() for physical cores
2020-09-15 21:38:47 +02:00
renaynay
0e9462eed2
renamed CLK_TCK variables for consistency across OSs
2020-05-12 15:36:18 +02:00
shirou
b0025409e9
[cpu][linux]: add cpuinfo parse check.
2019-11-14 21:47:42 +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
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
shirou
a11c78ba2c
Merge pull request #581 from CMGS/master
...
get docker container cpu usage from cpuacct.usage
2018-09-27 21:43:08 +09:00
Iskander Sharipov
f3d4342c30
cpu,process: remove commented-out code
...
Found using https://go-critic.github.io/overview#commentedOutCode-ref
2018-09-13 23:56:24 +03:00
CMGS
d93c01e54d
get docker container cpu usage from cpuacct.usage
2018-09-11 15:29:13 +08:00
shirou
145dca90f7
change to use CommandContext.
2018-03-31 21:35:53 +09:00
shirou
4c73494c78
Add WithContext functions.
2017-12-31 15:25:49 +09:00
Andrew Danforth
484470889f
Only read /proc/stat once when cpu.Times(true) is called on Linux
2017-06-09 22:34:58 -04:00
WAKAYAMA Shirou
3499dec5c0
[cpu]linux: handle hz values by tmm1
2017-03-23 21:36:54 +09:00
WAKAYAMA Shirou
a63f1aeeec
use Processor entry as model name fallback by @tmm1
2017-03-23 21:35:50 +09:00
WAKAYAMA Shirou
36b408780c
cpu[linux]: ignore cpufreq/cpuinfo_max_freq error
2017-03-21 00:55:21 +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
Sam Kleinman
915d1e930e
fix panic in starvation situations
2017-02-15 11:25:49 -05:00
shirou
77b5d0080a
Merge pull request #311 from sparrc/cpu-times-panic
...
fix panic when /proc/stat is empty
2017-02-02 09:16:45 +09:00
Cameron Sparr
0c9a1d33cb
fix panic when /proc/stat is empty
...
don't really know why this would be the case, but I suppose there are
always edge-cases.
see https://github.com/influxdata/telegraf/issues/2356
2017-02-01 23:13:59 +00:00
Cameron Sparr
a213bf5e6d
run go fmt ./...
2017-02-01 23:05:29 +00:00
Breno Leitao
286927a039
Improve CPU identification for POWER processors
...
Currently gopsutils fails to indentify the POWER processors family,
returning an almost empty Info() structure.
This patch improves the POWER identification without changing what is
available for x86.
2016-10-24 14:11:12 -04:00
Andreas Henriksson
9d51bfe3bb
Allow clock field in /proc/cpuinfo as cpu MHz fallback value
...
Needed on ppc64le debian porter boxes atleast.
See #230
2016-10-14 14:05:32 +02:00
K.C. Wong
3dc4e52844
Handle the case when the cpufreq
sysfs does not exist
...
* on virtualized host, this may happen.
* but we may have a value from parsing `/proc/cpuinfo`
* in this case, we do not return the error if we fail to extra
a value from `cpufreq/cpuinfo_max_freq`
2016-08-29 16:21:17 -07:00
K.C. Wong
10a1ae2123
Standardize Mhz
to mean maximum CPU frequency on Linux platform
...
* resolve #249
* in `cpu_windows.go`, `Mhz` is the value of `MaxClockSpeed`
* on Linux platform, the `Mhz` value is extracted from `/proc/cpuinfo`
which reflects the current clock speed; treat this as the fallback
value instead
* read from `cpufreq/cpuinfo_max_freq` under sysfs to get the
maximum clock speed for `Mhz`, just like for Windows platform
* also fix the path to `cpu.CoreID` value; the filename is `core_id`
2016-08-29 10:11:30 -07:00
K.C. Wong
123a6c9b0d
Addressing frequency unit discrepancies
...
* for Darwin, it is a minor tweak for readability: the value
returned is in Hz, so using a variable named 'hz' makes more
sense than 'mhz'
* for Linux, the unit is in kHz so we need to divide the value
from `cpuinfo_max_freq` by 10^3 to get MHz (see
cpu-freq/user-guide.txt of the kernel documentation)
2016-08-23 17:21:30 -07: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
5daf090513
[cpu]linux: vendorId in cpuinfo is sometimes vendor_id.
2016-04-12 23:08:13 +09:00
Shirou WAKAYAMA
bce9212def
fix build bugs.
2016-04-01 22:22:03 +09:00