Lomanic
c37a5eba8c
[cpu][netbsd] Fix "undefined: cpuTimes" error at compile time on arm
...
Fixes #1645
2024-10-09 00:20:24 +02:00
uubulb
9e6efdb991
update disk & cpu & process
2024-09-20 22:24:12 +08:00
uubulb
701a74be41
feat(cpu, mem, sensors)(darwin): cgo-free implementations
2024-09-04 23:23:10 +08:00
shirou
37f531010d
fix golangcilint errors, ignore gosec G115
2024-08-23 08:22:42 +00:00
shirou
3caf443966
[mem][windows]: add ExWindows and implement VirualTotal/Avail
...
This commit fixes #1588 . Thank you!
2024-05-28 22:27:17 +09:00
shirou
e9591b5b01
rename redundant test function names, such as TestCPU in cpu package
2024-05-28 22:27:17 +09:00
shirou
bc060cc227
add SPDX License, remove old build tag, and replace import
2024-05-28 22:27:17 +09:00
Dylan Myers
9bf502f825
Fix logic errors, syntax errors, and typos
2024-05-17 23:57:00 -04:00
Dylan Myers
d551997afb
Fix typos and code misplacement in AIX CPU handling
2024-05-15 22:07:56 -04:00
Dylan Myers
5d3cf2e9e7
Update AIX percpu minimum needed lines
2024-05-15 13:55:37 -04:00
Dylan Myers
0a1f220077
Remove tests, since my Go knowledge isn't yet deep enough for them
2024-05-15 13:54:44 -04:00
Dylan Myers
843d93a589
Add AIX test data
2024-05-15 12:59:23 -04:00
Dylan Myers
d816d96508
Initial pass at AIX test integration
2024-05-15 12:57:58 -04:00
Dylan Myers
af3f4d204d
Correct arguments for AIX percpu
2024-05-15 12:55:11 -04:00
Dylan Myers
8cc32696fe
Add support for additional CPU info fields
2024-05-15 10:46:07 -04:00
Dylan Myers
6b630a841a
Add support for per CPU
2024-05-15 09:49:08 -04:00
shirou
53fb8caad4
[darwin][ci]: skip frequency check on GitHub Action
2024-02-24 01:25:24 +00:00
Jonathan Matthew
27ffa28a0d
add support for OpenBSD/riscv64
2024-02-11 16:20:56 +10:00
shirou
4870f6f119
Merge pull request #1569 from scop/perf/regex-compile
...
Avoid repeated regexp compilations
2023-12-23 23:36:29 +09:00
Ville Skyttä
11bc5b3970
Avoid some uses of regexps
2023-12-21 10:00:30 +02:00
Ville Skyttä
362fa4b9c4
Avoid repeated regexp compilations
2023-12-21 09:51:14 +02:00
Jan De Dobbeleer
a1eedcae8e
fix(linux): validate cpu fields length before accessing index
2023-10-30 08:35:46 +01:00
Justin Yang
826037fe4b
Fix build_test on amd64 NetBSD
2023-09-29 16:36:44 +08:00
Justin Yang
7ffb24dbe3
Merge branch 'shirou:master' into feature/netbsd-arm64-port
2023-09-23 16:02:34 +08:00
Justin Yang
def3572629
format the code
2023-09-17 01:43:13 +08:00
Justin Yang
4a46201e00
cpu && host: fix compile time errors
2023-09-16 17:44:58 +08:00
shirou
0665cafa1b
chore: replace deprecated ioutil package to os and io
2023-09-08 17:05:14 +00:00
Justin Yang
6a4ec32f3b
cpu: remove wrong info copied from openbsd
2023-09-02 23:01:23 +08:00
shirou
febdeab871
chore: change CIRCLECI environment variable to CI.
2023-08-30 14:07:47 +00:00
Justin Yang
2684012ab2
Initial support for NetBSD.
...
Currently the changes are all copied from shirou/gopsutil#1364
2023-08-27 22:48:51 +08: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
Seth Hoenig
8617ff654a
cpu: add frequency support for apple silicon m1/m2 cpus
...
This PR adds support for reading the frequency of Apple Silicon
M1/M2 CPUs. We do so by reading the values out of the IOKit
framework, as a few other projects have now demonstrated to be
possible. This requires the use of CGO. The library provides a
convenience IsAppleSilicon() guard to detect whether the values
can be read.
Currently gopsutil does not support the big.LITTLE CPU architectures
(i think?) - in fact the P and E cores have different max frequencies.
For now, just read the P core frequency. The E core data is readily
available if we want to read it in the future.
Closes #1000
Small example program
```go
package main
import (
"fmt"
"github.com/shoenig/go-m1cpu"
"github.com/shirou/gopsutil/v3/cpu"
)
func main() {
fmt.Println("is Apple Silicon:", m1cpu.IsAppleSilicon())
fmt.Println("model name", m1cpu.ModelName())
fmt.Println("pCore GHz", m1cpu.PCoreGHz())
fmt.Println("eCore GHz", m1cpu.ECoreGHz())
fmt.Println("pCore Hz", m1cpu.PCoreHz())
fmt.Println("eCore Hz", m1cpu.ECoreHz())
fmt.Println("----- gopsutil ----")
infos, err := cpu.Info()
if err != nil {
panic(err)
}
for _, info := range infos {
fmt.Println("info.Mhz", info.Mhz)
}
}
```
```shell
go run main.go
is Apple Silicon: true
model name Apple M2 Pro
pCore GHz 3.504
eCore GHz 2.424
pCore Hz 3504000000
eCore Hz 2424000000
----- gopsutil ----
info.Mhz 3.504e+09
```
2023-03-27 21:17:12 -05: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
shirou
852f455217
fix lint
2023-02-12 09:24:52 +00: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
Eng Zer Jun
37894e9b28
test: use T.Setenv
to set env vars in tests
...
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.
Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-12-20 13:13:01 +08:00
shirou
835767a611
Merge pull request #1389 from sgthammer/feature/fix-arm-modelname
...
fill modelName for all cores in arm64 devices
2022-12-19 22:14:07 +09:00
Tobias Klauser
f2bf9a480a
cpu: use windows.GetActiveProcessorCount
...
Use GetActiveProcessorCount and the ALL_PROCESSOR_GROUPS const provided
in golang.org/x/sys/windows. The function is available on Windows 7 and
later. Go requires Windows 7, see https://go.dev/doc/go1.11#ports
2022-12-07 13:51:29 +01: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
shirou
d1cc7d2125
fix(cpu): fix cpu total and busy calc
2022-07-09 02:13:44 +00:00
xca1075
3d643b9b73
parse cpu values as float
2022-06-17 15:10:37 +02:00
xca1075
b3ab1561bc
more aix nocgo implementations
2022-06-17 14:53:16 +02:00
xca1075
d4f012c565
fix aix nocgo compile
2022-06-03 17:43:52 +02:00