Skip to content

Commit

Permalink
fix dependabot v2 deletion.
Browse files Browse the repository at this point in the history
  • Loading branch information
shirou committed Dec 1, 2021
1 parent 0969c94 commit d2e27c1
Show file tree
Hide file tree
Showing 31 changed files with 371 additions and 474 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ updates:
directory: /
schedule:
interval: daily
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ jobs:
with:
args: --verbose
version: latest
working-directory: v3
148 changes: 0 additions & 148 deletions Gopkg.lock

This file was deleted.

46 changes: 0 additions & 46 deletions Gopkg.toml

This file was deleted.

74 changes: 74 additions & 0 deletions cpu/cpu_aix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// +build aix

package cpu

import (
"context"

"github.com/power-devops/perfstat"
)

func Times(percpu bool) ([]TimesStat, error) {
return TimesWithContext(context.Background(), percpu)
}

func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
var ret []TimesStat
if percpu {
cpus, err := perfstat.CpuStat()
if err != nil {
return nil, err
}
for _, c := range cpus {
ct := &TimesStat{
CPU: c.Name,
Idle: float64(c.Idle),
User: float64(c.User),
System: float64(c.Sys),
Iowait: float64(c.Wait),
}
ret = append(ret, *ct)
}
} else {
c, err := perfstat.CpuUtilTotalStat()
if err != nil {
return nil, err
}
ct := &TimesStat{
CPU: "cpu-total",
Idle: float64(c.IdlePct),
User: float64(c.UserPct),
System: float64(c.KernPct),
Iowait: float64(c.WaitPct),
}
ret = append(ret, *ct)
}
return ret, nil
}

func Info() ([]InfoStat, error) {
return InfoWithContext(context.Background())
}

func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
c, err := perfstat.CpuTotalStat()
if err != nil {
return nil, err
}
info := InfoStat{
CPU: 0,
Mhz: float64(c.ProcessorHz / 1000000),
Cores: int32(c.NCpusCfg),
}
result := []InfoStat{info};
return result, nil
}

func CountsWithContext(ctx context.Context, logical bool) (int, error) {
c, err := perfstat.CpuTotalStat()
if err != nil {
return 0, err
}
return c.NCpusCfg, nil
}

2 changes: 1 addition & 1 deletion cpu/cpu_fallback.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !darwin,!linux,!freebsd,!openbsd,!solaris,!windows,!dragonfly,!plan9
// +build !darwin,!linux,!freebsd,!openbsd,!solaris,!windows,!dragonfly,!plan9,!aix

package cpu

Expand Down
2 changes: 1 addition & 1 deletion cpu/cpu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func parseStatLine(line string) (*TimesStat, error) {
return nil, errors.New("stat does not contain cpu info")
}

if strings.HasPrefix(fields[0], "cpu") == false {
if !strings.HasPrefix(fields[0], "cpu") {
return nil, errors.New("not contain cpu")
}

Expand Down
3 changes: 1 addition & 2 deletions cpu/cpu_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//go:build windows
// +build windows

package cpu
Expand All @@ -8,8 +7,8 @@ import (
"fmt"
"unsafe"

"github.com/shirou/gopsutil/v3/internal/common"
"github.com/yusufpapurcu/wmi"
"github.com/shirou/gopsutil/v3/internal/common"
"golang.org/x/sys/windows"
)

Expand Down
Empty file modified cpu/testdata/linux/times_empty/proc/stat
100755 → 100644
Empty file.
Loading

0 comments on commit d2e27c1

Please sign in to comment.