Commit Graph

2457 Commits (c0546fb392440dce7271930885241524709968d4)
 

Author SHA1 Message Date
dependabot[bot] 13b3618b1e
chore(deps): bump github.com/shoenig/go-m1cpu from 0.1.4 to 0.1.5
Bumps [github.com/shoenig/go-m1cpu](https://github.com/shoenig/go-m1cpu) from 0.1.4 to 0.1.5.
- [Release notes](https://github.com/shoenig/go-m1cpu/releases)
- [Commits](https://github.com/shoenig/go-m1cpu/compare/v0.1.4...v0.1.5)

---
updated-dependencies:
- dependency-name: github.com/shoenig/go-m1cpu
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
Matthieu MOREL 1fb1e3e3e6 ci(lint): correct gci linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2 years ago
shirou 6bda1a5c01
Merge pull request #1436 from shoenig/support-mhz-apple-silicon
cpu: add frequency support for apple silicon m1/m2 cpus
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 c0365978d8
Merge pull request #1433 from shirou/feature/ignore_revive_issues
chore(golangci-lint): exlucde unused-parameters and empty-block rule
2 years ago
shirou 24be017cf9 chore(golangci-lint): exlucde unused-parameters and empty-block rule
These are intentional.
2 years ago
shirou 586926508c
Merge pull request #1431 from powersj/fix/1429
fix: moves common.Warnings to common OS files
2 years ago
shirou 27c8bfae7a
Merge pull request #1430 from davidnewhall/master
Fix 'send on closed channel' bug with windows disks
2 years ago
shirou 06a922c621
Merge pull request #1432 from shirou/dependabot/github_actions/actions/setup-go-4
chore(deps): bump actions/setup-go from 3 to 4
2 years ago
dependabot[bot] 0f0223064d
chore(deps): bump actions/setup-go from 3 to 4
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
Josh Powers e7c6b6991d
fix: moves common.Warnings to common OS files
This allows all OS types to unwrap the Warnings from errors, and not
just linux in host or windows in disk.

fixes: #1429
2 years ago
David Newhall II 3a88ef27a5 close channel in function that sends to it 2 years ago
shirou c7c548d6bd
Merge pull request #1428 from dhurley/add-support-for-process-exe-for-freebsd
FreeBSD process exe support
2 years ago
shirou 50d889cc59
Merge pull request #1421 from jak3kaj/cumulus-linux-support
Recognize Cumulus Linux distro
2 years ago
Jacob Young 02660eaf7c
Update host/host_linux.go
Use a raw string instead of escaped quotes.

Co-authored-by: shirou <shirou.faw@gmail.com>
2 years ago
Donal Hurley cf25de7460 Add support for getting process exe in FreeBSD 2 years ago
shirou dda567eee6
Merge pull request #1427 from shirou/dependabot/go_modules/golang.org/x/sys-0.6.0
chore(deps): bump golang.org/x/sys from 0.5.0 to 0.6.0
2 years ago
dependabot[bot] 78d3bf5ace
chore(deps): bump golang.org/x/sys from 0.5.0 to 0.6.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
shirou ad7274d0cc
Merge pull request #1426 from 3139487747/patch-1
English case error
2 years ago
syyyj 39770901ac
English case error
m to M
2 years ago
shirou 7ab2f0eba3
Merge pull request #1423 from shirou/dependabot/go_modules/github.com/stretchr/testify-1.8.2
chore(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2
2 years ago
dependabot[bot] 1e85027fe4
chore(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.1...v1.8.2)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
Jacob Young 43566581f0 Recognize Cumulus Linux distro
Add Cumulus Linux and Kylin to debian family
2 years ago
shirou b51f72ebfb
Merge pull request #1412 from powersj/fix/dm-resolution
fix(disk): correctly replace /dev in /dev/mapper
2 years ago
shirou 1c27744fc9
Merge pull request #1413 from shirou/dependabot/go_modules/golang.org/x/sys-0.5.0
chore(deps): bump golang.org/x/sys from 0.4.0 to 0.5.0
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 57bee8213a
Merge pull request #1417 from shirou/feature/fix_lint
fix lint
2 years ago
shirou 852f455217 fix lint 2 years ago
shirou 6a5e40a517
Merge pull request #1228 from abner-chenc/master
host: add support for linux/loong64
2 years ago
shirou e563e6394e
Merge pull request #1356 from N1neSun/patch-1
fix some kylin linux bug
2 years ago
Jeff Weiss f850a69ba1 get tests passing on s390x 2 years ago
dependabot[bot] f71fb1e37f
chore(deps): bump golang.org/x/sys from 0.4.0 to 0.5.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.4.0...v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
Josh Powers d22f238125
lint: resolve lint issues in master 2 years ago
Josh Powers 7645051510
fix(disk): correctly replace /dev in /dev/mapper
Only replace the first instance of /dev in a /dev/mapper string.
Otherwise, if an LVM group is named dev it will replace that as well.

fixes: #1411
2 years ago
shirou 0494d7f0b9
Merge pull request #1403 from Agilicus/add-ppc64be
[host] linux/ppc: ppc64 definition from ppc64le
2 years ago
shirou 2aa7394ecc
Merge pull request #1407 from shirou/feature/change_contextable_disk_partitions_windows
[disk][windows]: add context handling on PartionsWithContext
2 years ago
shirou 301930f9bd
Merge pull request #1404 from shirou/dependabot/go_modules/golang.org/x/sys-0.4.0
chore(deps): bump golang.org/x/sys from 0.3.0 to 0.4.0
2 years ago
shirou 8105a6d577 [disk][windows]: add context handling on PartionsWithContext 2 years ago
Guoqi Chen b793d83f72 host: add support for linux/loong64
Updates #1338.

Signed-off-by: Guoqi Chen <chenguoqi@loongson.cn>
Co-authored-by: Jiantao Shan <shanjiantao@loongson.cn>
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
dependabot[bot] 87931ed66f
chore(deps): bump golang.org/x/sys from 0.3.0 to 0.4.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
shirou 581c27c0e6
Merge pull request #1397 from jefferbrecht/jefferbrecht-windows-host
[host] windows: use millisecond precision for BootTime()
2 years ago
Jeff Erbrecht a5ecb9bca5 [host] windows: use millisecond precision for BootTime()
Previously, system uptime is truncated to seconds, and then the
subtraction from `time.Now()` is performed. Because uptime does not roll
over to the next second at the same instant as `time.Now()`, then
`BootTime()` ends up not being precise, and often varies by 1 second.

This commit does the subtraction before truncating to seconds, which
results in a significantly lower chance of variance in `BootTime()`.
2 years ago
Don Bowman d7f1f76519
[host] linux/ppc: ppc64 definition from ppc64le
Same as commit fc04d2d, but for ppc64 from ppc64le definition.
2 years ago
shirou 2fb67aaf4a
Merge pull request #1401 from shirou/feature/add_HOST_ROOT_to_readme
chore(README): add `HOST_ROOT`
2 years ago
shirou 46c4ce3ffc chore(README): add `HOST_ROOT` introduced by #1400 2 years ago
shirou ca886f9316
Merge pull request #1400 from scop/dockerenv
Detect Docker also using /.dockerenv
2 years ago
Ville Skyttä 70a8f589c6 Detect Docker also using /.dockerenv 2 years ago
shirou f848ee3fa2
Merge pull request #1398 from Juneezee/test/t.Setenv
test: use `T.Setenv` to set env vars in tests
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