shirou
9d29c70c52
Merge pull request #1813 from mmorel-35/gocritic
...
chore: enable gocritic linter
2 months ago
shirou
2ab27a0ba3
Merge pull request #1817 from mmorel-35/revive/var-naming
...
chore: enable var-naming from revive
2 months ago
Matthieu MOREL
dfdd90ab72
chore: enable gocritic linter
2 months ago
Matthieu MOREL
9925fd41ec
chore: enable var-naming from revive
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2 months ago
Matthieu MOREL
a5e496769c
chore: enable begin rule from thelper
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2 months ago
Matthieu MOREL
8c1a718a5d
chore: use testify instead of testing
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2 months ago
Matthieu MOREL
0a45e0f24d
chore(golangci-lint): cover aix and cgo
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2 months ago
Matthieu MOREL
30aff030d0
chore(golangci-lint): GOOS and GOARCH matrix
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
3 months ago
Matthieu MOREL
9ce2ec161e
chore: enable golangci-lint on Windows and MacOS
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
4 months ago
uubulb
1f39525d2d
refactor(darwin): optimize string allocation
5 months ago
Matthieu MOREL
7e19b35f50
enable all rules of perfsprint linter
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
5 months ago
Lomanic
c37a5eba8c
[cpu][netbsd] Fix "undefined: cpuTimes" error at compile time on arm
...
Fixes #1645
7 months ago
uubulb
9e6efdb991
update disk & cpu & process
8 months ago
uubulb
701a74be41
feat(cpu, mem, sensors)(darwin): cgo-free implementations
9 months ago
shirou
37f531010d
fix golangcilint errors, ignore gosec G115
9 months ago
shirou
3caf443966
[mem][windows]: add ExWindows and implement VirualTotal/Avail
...
This commit fixes #1588 . Thank you!
12 months ago
shirou
e9591b5b01
rename redundant test function names, such as TestCPU in cpu package
12 months ago
shirou
bc060cc227
add SPDX License, remove old build tag, and replace import
12 months ago
Dylan Myers
9bf502f825
Fix logic errors, syntax errors, and typos
1 year ago
Dylan Myers
d551997afb
Fix typos and code misplacement in AIX CPU handling
1 year ago
Dylan Myers
5d3cf2e9e7
Update AIX percpu minimum needed lines
1 year ago
Dylan Myers
0a1f220077
Remove tests, since my Go knowledge isn't yet deep enough for them
1 year ago
Dylan Myers
843d93a589
Add AIX test data
1 year ago
Dylan Myers
d816d96508
Initial pass at AIX test integration
1 year ago
Dylan Myers
af3f4d204d
Correct arguments for AIX percpu
1 year ago
Dylan Myers
8cc32696fe
Add support for additional CPU info fields
1 year ago
Dylan Myers
6b630a841a
Add support for per CPU
1 year ago
shirou
53fb8caad4
[darwin][ci]: skip frequency check on GitHub Action
1 year ago
Jonathan Matthew
27ffa28a0d
add support for OpenBSD/riscv64
1 year ago
shirou
4870f6f119
Merge pull request #1569 from scop/perf/regex-compile
...
Avoid repeated regexp compilations
1 year ago
Ville Skyttä
11bc5b3970
Avoid some uses of regexps
1 year ago
Ville Skyttä
362fa4b9c4
Avoid repeated regexp compilations
1 year ago
Jan De Dobbeleer
a1eedcae8e
fix(linux): validate cpu fields length before accessing index
2 years ago
Justin Yang
826037fe4b
Fix build_test on amd64 NetBSD
2 years ago
Justin Yang
7ffb24dbe3
Merge branch 'shirou:master' into feature/netbsd-arm64-port
2 years ago
Justin Yang
def3572629
format the code
2 years ago
Justin Yang
4a46201e00
cpu && host: fix compile time errors
2 years ago
shirou
0665cafa1b
chore: replace deprecated ioutil package to os and io
2 years ago
Justin Yang
6a4ec32f3b
cpu: remove wrong info copied from openbsd
2 years ago
shirou
febdeab871
chore: change CIRCLECI environment variable to CI.
2 years ago
Justin Yang
2684012ab2
Initial support for NetBSD.
...
Currently the changes are all copied from shirou/gopsutil#1364
2 years ago
Kishen V
63e0b63ab8
Enable setting of vendor and related information for all Power versions
2 years ago
Antoine Toulme
38b94668ea
allow to pass context values to override environment variables
2 years ago
Matthieu MOREL
1fb1e3e3e6
ci(lint): correct gci linter
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2 years ago
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
```
2 years ago
shirou
f78f9a6bb8
Merge pull request #1414 from jeffweiss/bugfix/get_tests_working_on_s390x
...
get tests passing on s390x
2 years ago
shirou
852f455217
fix lint
2 years ago
Jeff Weiss
f850a69ba1
get tests passing on s390x
2 years ago
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>
2 years ago
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>
2 years ago