mirror of
https://github.com/google/gops.git
synced 2025-02-19 19:59:55 +02:00
build(deps): bump github.com/shirou/gopsutil/v3 from 3.22.4 to 3.22.7
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.4 to 3.22.7. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v3.22.4...v3.22.7) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
parent
ab74a57fd9
commit
1b6dca4616
2
go.mod
2
go.mod
@ -4,7 +4,7 @@ go 1.13
|
||||
|
||||
require (
|
||||
github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19
|
||||
github.com/shirou/gopsutil/v3 v3.22.4
|
||||
github.com/shirou/gopsutil/v3 v3.22.7
|
||||
github.com/spf13/cobra v1.5.0
|
||||
github.com/xlab/treeprint v1.1.0
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
|
||||
|
19
go.sum
19
go.sum
@ -1,11 +1,12 @@
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
|
||||
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19 h1:WjT3fLi9n8YWh/Ih8Q1LHAPsTqGddPcHqscN+PJ3i68=
|
||||
@ -17,16 +18,18 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/shirou/gopsutil/v3 v3.22.4 h1:srAQaiX6jX/cYL6q29aE0m8lOskT9CurZ9N61YR3yoI=
|
||||
github.com/shirou/gopsutil/v3 v3.22.4/go.mod h1:D01hZJ4pVHPpCTZ3m3T2+wDF2YAGfd+H4ifUguaQzHM=
|
||||
github.com/shirou/gopsutil/v3 v3.22.7 h1:flKnuCMfUUrO+oAvwAd6GKZgnPzr098VA/UJ14nhJd4=
|
||||
github.com/shirou/gopsutil/v3 v3.22.7/go.mod h1:s648gW4IywYzUfE/KjXxUsqrqx/T2xO5VqOXxONeRfI=
|
||||
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
|
||||
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw=
|
||||
github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
|
||||
github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o=
|
||||
@ -40,12 +43,12 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
rsc.io/goversion v1.2.0 h1:SPn+NLTiAG7w30IRK/DKp1BjvpWabYgxlLp/+kx5J8w=
|
||||
rsc.io/goversion v1.2.0/go.mod h1:Eih9y/uIBS3ulggl7KNJ09xGSLcuNaLgmvvqa07sgfo=
|
||||
|
21
vendor/github.com/shirou/gopsutil/v3/cpu/cpu.go
generated
vendored
21
vendor/github.com/shirou/gopsutil/v3/cpu/cpu.go
generated
vendored
@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -86,10 +87,12 @@ func (c TimesStat) String() string {
|
||||
return `{` + strings.Join(v, ",") + `}`
|
||||
}
|
||||
|
||||
// Total returns the total number of seconds in a CPUTimesStat
|
||||
// Deprecated: Total returns the total number of seconds in a CPUTimesStat
|
||||
// Please do not use this internal function.
|
||||
func (c TimesStat) Total() float64 {
|
||||
total := c.User + c.System + c.Nice + c.Iowait + c.Irq + c.Softirq +
|
||||
c.Steal + c.Idle
|
||||
total := c.User + c.System + c.Idle + c.Nice + c.Iowait + c.Irq +
|
||||
c.Softirq + c.Steal + c.Guest + c.GuestNice
|
||||
|
||||
return total
|
||||
}
|
||||
|
||||
@ -99,9 +102,15 @@ func (c InfoStat) String() string {
|
||||
}
|
||||
|
||||
func getAllBusy(t TimesStat) (float64, float64) {
|
||||
busy := t.User + t.System + t.Nice + t.Iowait + t.Irq +
|
||||
t.Softirq + t.Steal
|
||||
return busy + t.Idle, busy
|
||||
tot := t.Total()
|
||||
if runtime.GOOS == "linux" {
|
||||
tot -= t.Guest // Linux 2.6.24+
|
||||
tot -= t.GuestNice // Linux 3.2.0+
|
||||
}
|
||||
|
||||
busy := tot - t.Idle - t.Iowait
|
||||
|
||||
return tot, busy
|
||||
}
|
||||
|
||||
func calculateBusy(t1, t2 TimesStat) float64 {
|
||||
|
58
vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix.go
generated
vendored
58
vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix.go
generated
vendored
@ -5,70 +5,12 @@ 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
|
||||
}
|
||||
|
66
vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_cgo.go
generated
vendored
Normal file
66
vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_cgo.go
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
//go:build aix && cgo
|
||||
// +build aix,cgo
|
||||
|
||||
package cpu
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/power-devops/perfstat"
|
||||
)
|
||||
|
||||
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 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
|
||||
}
|
95
vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_nocgo.go
generated
vendored
Normal file
95
vendor/github.com/shirou/gopsutil/v3/cpu/cpu_aix_nocgo.go
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
//go:build aix && !cgo
|
||||
// +build aix,!cgo
|
||||
|
||||
package cpu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"regexp"
|
||||
"strings"
|
||||
"strconv"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
)
|
||||
|
||||
var whiteSpaces = regexp.MustCompile(`\s+`)
|
||||
|
||||
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
|
||||
if percpu {
|
||||
return []TimesStat{}, common.ErrNotImplementedError
|
||||
} else {
|
||||
out, err := invoke.CommandWithContext(ctx, "sar", "-u", "10", "1")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
lines := strings.Split(string(out), "\n")
|
||||
if len(lines) < 5 {
|
||||
return []TimesStat{}, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
ret := TimesStat{CPU: "cpu-total"}
|
||||
h := whiteSpaces.Split(lines[len(lines)-3], -1) // headers
|
||||
v := whiteSpaces.Split(lines[len(lines)-2], -1) // values
|
||||
for i, header := range h {
|
||||
if t, err := strconv.ParseFloat(v[i], 64); err == nil {
|
||||
switch header {
|
||||
case `%usr`:
|
||||
ret.User = t
|
||||
case `%sys`:
|
||||
ret.System = t
|
||||
case `%wio`:
|
||||
ret.Iowait = t
|
||||
case `%idle`:
|
||||
ret.Idle = t
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return []TimesStat{ret}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
|
||||
out, err := invoke.CommandWithContext(ctx, "prtconf")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ret := InfoStat{}
|
||||
for _, line := range strings.Split(string(out), "\n") {
|
||||
if strings.HasPrefix(line, "Number Of Processors:") {
|
||||
p := whiteSpaces.Split(line, 4)
|
||||
if len(p) > 3 {
|
||||
if t, err := strconv.ParseUint(p[3], 10, 64); err == nil {
|
||||
ret.Cores = int32(t)
|
||||
}
|
||||
}
|
||||
} else if strings.HasPrefix(line, "Processor Clock Speed:") {
|
||||
p := whiteSpaces.Split(line, 5)
|
||||
if len(p) > 4 {
|
||||
if t, err := strconv.ParseFloat(p[3], 64); err == nil {
|
||||
switch strings.ToUpper(p[4]) {
|
||||
case "MHZ":
|
||||
ret.Mhz = t
|
||||
case "GHZ":
|
||||
ret.Mhz = t * 1000.0
|
||||
case "KHZ":
|
||||
ret.Mhz = t / 1000.0
|
||||
default:
|
||||
ret.Mhz = t
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
return []InfoStat{ret}, nil
|
||||
}
|
||||
|
||||
func CountsWithContext(ctx context.Context, logical bool) (int, error) {
|
||||
info, err := InfoWithContext(ctx)
|
||||
if err == nil {
|
||||
return int(info[0].Cores), nil
|
||||
}
|
||||
return 0, err
|
||||
}
|
9
vendor/github.com/shirou/gopsutil/v3/internal/common/common.go
generated
vendored
9
vendor/github.com/shirou/gopsutil/v3/internal/common/common.go
generated
vendored
@ -311,6 +311,15 @@ func PathExists(filename string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// PathExistsWithContents returns the filename exists and it is not empty
|
||||
func PathExistsWithContents(filename string) bool {
|
||||
info, err := os.Stat(filename)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return info.Size() > 4 // at least 4 bytes
|
||||
}
|
||||
|
||||
// GetEnv retrieves the environment variable key. If it does not exist it returns the default.
|
||||
func GetEnv(key string, dfault string, combineWith ...string) string {
|
||||
value := os.Getenv(key)
|
||||
|
6
vendor/github.com/shirou/gopsutil/v3/internal/common/common_linux.go
generated
vendored
6
vendor/github.com/shirou/gopsutil/v3/internal/common/common_linux.go
generated
vendored
@ -274,6 +274,12 @@ func GetOSRelease() (platform string, version string, err error) {
|
||||
version = trimQuotes(field[1])
|
||||
}
|
||||
}
|
||||
|
||||
// cleanup amazon ID
|
||||
if platform == "amzn" {
|
||||
platform = "amazon"
|
||||
}
|
||||
|
||||
return platform, version, nil
|
||||
}
|
||||
|
||||
|
10
vendor/github.com/shirou/gopsutil/v3/internal/common/endian.go
generated
vendored
Normal file
10
vendor/github.com/shirou/gopsutil/v3/internal/common/endian.go
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
package common
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// IsLittleEndian checks if the current platform uses little-endian.
|
||||
// copied from https://github.com/ntrrg/ntgo/blob/v0.8.0/runtime/infrastructure.go#L16 (MIT License)
|
||||
func IsLittleEndian() bool {
|
||||
var x int16 = 0x0011
|
||||
return *(*byte)(unsafe.Pointer(&x)) == 0x11
|
||||
}
|
2
vendor/github.com/shirou/gopsutil/v3/mem/mem.go
generated
vendored
2
vendor/github.com/shirou/gopsutil/v3/mem/mem.go
generated
vendored
@ -75,6 +75,8 @@ type VirtualMemoryStat struct {
|
||||
VmallocChunk uint64 `json:"vmallocChunk"`
|
||||
HugePagesTotal uint64 `json:"hugePagesTotal"`
|
||||
HugePagesFree uint64 `json:"hugePagesFree"`
|
||||
HugePagesRsvd uint64 `json:"hugePagesRsvd"`
|
||||
HugePagesSurp uint64 `json:"hugePagesSurp"`
|
||||
HugePageSize uint64 `json:"hugePageSize"`
|
||||
}
|
||||
|
||||
|
43
vendor/github.com/shirou/gopsutil/v3/mem/mem_aix.go
generated
vendored
43
vendor/github.com/shirou/gopsutil/v3/mem/mem_aix.go
generated
vendored
@ -5,55 +5,12 @@ package mem
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/power-devops/perfstat"
|
||||
)
|
||||
|
||||
func VirtualMemory() (*VirtualMemoryStat, error) {
|
||||
return VirtualMemoryWithContext(context.Background())
|
||||
}
|
||||
|
||||
func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) {
|
||||
m, err := perfstat.MemoryTotalStat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pagesize := uint64(4096)
|
||||
ret := VirtualMemoryStat{
|
||||
Total: uint64(m.RealTotal) * pagesize,
|
||||
Available: uint64(m.RealAvailable) * pagesize,
|
||||
Free: uint64(m.RealFree) * pagesize,
|
||||
Used: uint64(m.RealInUse) * pagesize,
|
||||
UsedPercent: 100 * float64(m.RealInUse) / float64(m.RealTotal),
|
||||
Active: uint64(m.VirtualActive) * pagesize,
|
||||
SwapTotal: uint64(m.PgSpTotal) * pagesize,
|
||||
SwapFree: uint64(m.PgSpFree) * pagesize,
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
||||
|
||||
func SwapMemory() (*SwapMemoryStat, error) {
|
||||
return SwapMemoryWithContext(context.Background())
|
||||
}
|
||||
|
||||
func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) {
|
||||
m, err := perfstat.MemoryTotalStat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pagesize := uint64(4096)
|
||||
swapUsed := uint64(m.PgSpTotal-m.PgSpFree-m.PgSpRsvd) * pagesize
|
||||
swapTotal := uint64(m.PgSpTotal) * pagesize
|
||||
ret := SwapMemoryStat{
|
||||
Total: swapTotal,
|
||||
Free: uint64(m.PgSpFree) * pagesize,
|
||||
Used: swapUsed,
|
||||
UsedPercent: float64(100*swapUsed) / float64(swapTotal),
|
||||
Sin: uint64(m.PgSpIn),
|
||||
Sout: uint64(m.PgSpOut),
|
||||
PgIn: uint64(m.PageIn),
|
||||
PgOut: uint64(m.PageOut),
|
||||
PgFault: uint64(m.PageFaults),
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
||||
|
51
vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_cgo.go
generated
vendored
Normal file
51
vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_cgo.go
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
//go:build aix && cgo
|
||||
// +build aix,cgo
|
||||
|
||||
package mem
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/power-devops/perfstat"
|
||||
)
|
||||
|
||||
func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) {
|
||||
m, err := perfstat.MemoryTotalStat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pagesize := uint64(4096)
|
||||
ret := VirtualMemoryStat{
|
||||
Total: uint64(m.RealTotal) * pagesize,
|
||||
Available: uint64(m.RealAvailable) * pagesize,
|
||||
Free: uint64(m.RealFree) * pagesize,
|
||||
Used: uint64(m.RealInUse) * pagesize,
|
||||
UsedPercent: 100 * float64(m.RealInUse) / float64(m.RealTotal),
|
||||
Active: uint64(m.VirtualActive) * pagesize,
|
||||
SwapTotal: uint64(m.PgSpTotal) * pagesize,
|
||||
SwapFree: uint64(m.PgSpFree) * pagesize,
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
||||
|
||||
func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) {
|
||||
m, err := perfstat.MemoryTotalStat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pagesize := uint64(4096)
|
||||
swapUsed := uint64(m.PgSpTotal-m.PgSpFree-m.PgSpRsvd) * pagesize
|
||||
swapTotal := uint64(m.PgSpTotal) * pagesize
|
||||
ret := SwapMemoryStat{
|
||||
Total: swapTotal,
|
||||
Free: uint64(m.PgSpFree) * pagesize,
|
||||
Used: swapUsed,
|
||||
UsedPercent: float64(100*swapUsed) / float64(swapTotal),
|
||||
Sin: uint64(m.PgSpIn),
|
||||
Sout: uint64(m.PgSpOut),
|
||||
PgIn: uint64(m.PageIn),
|
||||
PgOut: uint64(m.PageOut),
|
||||
PgFault: uint64(m.PageFaults),
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
81
vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_nocgo.go
generated
vendored
Normal file
81
vendor/github.com/shirou/gopsutil/v3/mem/mem_aix_nocgo.go
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
//go:build aix && !cgo
|
||||
// +build aix,!cgo
|
||||
|
||||
package mem
|
||||
|
||||
import (
|
||||
"context"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
)
|
||||
|
||||
var whiteSpaces = regexp.MustCompile(`\s+`)
|
||||
|
||||
func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) {
|
||||
vmem, swap, err := callSVMon(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if vmem.Total == 0 {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
vmem.SwapTotal = swap.Total
|
||||
vmem.SwapFree = swap.Free
|
||||
return vmem, nil
|
||||
}
|
||||
|
||||
func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) {
|
||||
_, swap, err := callSVMon(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if swap.Total == 0 {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
return swap, nil
|
||||
}
|
||||
|
||||
func callSVMon(ctx context.Context) (*VirtualMemoryStat, *SwapMemoryStat, error) {
|
||||
out, err := invoke.CommandWithContext(ctx, "svmon", "-G")
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pagesize := uint64(4096)
|
||||
vmem := &VirtualMemoryStat{}
|
||||
swap := &SwapMemoryStat{}
|
||||
for _, line := range strings.Split(string(out), "\n") {
|
||||
if strings.HasPrefix(line, "memory") {
|
||||
p := whiteSpaces.Split(line, 7)
|
||||
if len(p) > 2 {
|
||||
if t, err := strconv.ParseUint(p[1], 10, 64); err == nil {
|
||||
vmem.Total = t * pagesize
|
||||
}
|
||||
if t, err := strconv.ParseUint(p[2], 10, 64); err == nil {
|
||||
vmem.Used = t * pagesize
|
||||
if vmem.Total > 0 {
|
||||
vmem.UsedPercent = 100 * float64(vmem.Used) / float64(vmem.Total)
|
||||
}
|
||||
}
|
||||
if t, err := strconv.ParseUint(p[3], 10, 64); err == nil {
|
||||
vmem.Free = t * pagesize
|
||||
}
|
||||
}
|
||||
} else if strings.HasPrefix(line, "pg space") {
|
||||
p := whiteSpaces.Split(line, 4)
|
||||
if len(p) > 3 {
|
||||
if t, err := strconv.ParseUint(p[2], 10, 64); err == nil {
|
||||
swap.Total = t * pagesize
|
||||
}
|
||||
if t, err := strconv.ParseUint(p[3], 10, 64); err == nil {
|
||||
swap.Free = swap.Total - t * pagesize
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
return vmem, swap, nil
|
||||
}
|
5
vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin_cgo.go
generated
vendored
5
vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin_cgo.go
generated
vendored
@ -5,6 +5,7 @@ package mem
|
||||
|
||||
/*
|
||||
#include <mach/mach_host.h>
|
||||
#include <mach/vm_page_size.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
@ -12,8 +13,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// VirtualMemory returns VirtualmemoryStat.
|
||||
@ -34,7 +33,7 @@ func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) {
|
||||
return nil, fmt.Errorf("host_statistics error=%d", status)
|
||||
}
|
||||
|
||||
pageSize := uint64(unix.Getpagesize())
|
||||
pageSize := uint64(C.vm_kernel_page_size)
|
||||
total, err := getHwMemsize()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
12
vendor/github.com/shirou/gopsutil/v3/mem/mem_linux.go
generated
vendored
12
vendor/github.com/shirou/gopsutil/v3/mem/mem_linux.go
generated
vendored
@ -292,6 +292,18 @@ func fillFromMeminfoWithContext() (*VirtualMemoryStat, *VirtualMemoryExStat, err
|
||||
return ret, retEx, err
|
||||
}
|
||||
ret.HugePagesFree = t
|
||||
case "HugePages_Rsvd":
|
||||
t, err := strconv.ParseUint(value, 10, 64)
|
||||
if err != nil {
|
||||
return ret, retEx, err
|
||||
}
|
||||
ret.HugePagesRsvd = t
|
||||
case "HugePages_Surp":
|
||||
t, err := strconv.ParseUint(value, 10, 64)
|
||||
if err != nil {
|
||||
return ret, retEx, err
|
||||
}
|
||||
ret.HugePagesSurp = t
|
||||
case "Hugepagesize":
|
||||
t, err := strconv.ParseUint(value, 10, 64)
|
||||
if err != nil {
|
||||
|
82
vendor/github.com/shirou/gopsutil/v3/net/net_aix.go
generated
vendored
82
vendor/github.com/shirou/gopsutil/v3/net/net_aix.go
generated
vendored
@ -14,92 +14,10 @@ import (
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
)
|
||||
|
||||
func parseNetstatI(output string) ([]IOCountersStat, error) {
|
||||
lines := strings.Split(string(output), "\n")
|
||||
ret := make([]IOCountersStat, 0, len(lines)-1)
|
||||
exists := make([]string, 0, len(ret))
|
||||
|
||||
// Check first line is header
|
||||
if len(lines) > 0 && strings.Fields(lines[0])[0] != "Name" {
|
||||
return nil, fmt.Errorf("not a 'netstat -i' output")
|
||||
}
|
||||
|
||||
for _, line := range lines[1:] {
|
||||
values := strings.Fields(line)
|
||||
if len(values) < 1 || values[0] == "Name" {
|
||||
continue
|
||||
}
|
||||
if common.StringsHas(exists, values[0]) {
|
||||
// skip if already get
|
||||
continue
|
||||
}
|
||||
exists = append(exists, values[0])
|
||||
|
||||
if len(values) < 9 {
|
||||
continue
|
||||
}
|
||||
|
||||
base := 1
|
||||
// sometimes Address is omitted
|
||||
if len(values) < 10 {
|
||||
base = 0
|
||||
}
|
||||
|
||||
parsed := make([]uint64, 0, 5)
|
||||
vv := []string{
|
||||
values[base+3], // Ipkts == PacketsRecv
|
||||
values[base+4], // Ierrs == Errin
|
||||
values[base+5], // Opkts == PacketsSent
|
||||
values[base+6], // Oerrs == Errout
|
||||
values[base+8], // Drops == Dropout
|
||||
}
|
||||
|
||||
for _, target := range vv {
|
||||
if target == "-" {
|
||||
parsed = append(parsed, 0)
|
||||
continue
|
||||
}
|
||||
|
||||
t, err := strconv.ParseUint(target, 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
parsed = append(parsed, t)
|
||||
}
|
||||
|
||||
n := IOCountersStat{
|
||||
Name: values[0],
|
||||
PacketsRecv: parsed[0],
|
||||
Errin: parsed[1],
|
||||
PacketsSent: parsed[2],
|
||||
Errout: parsed[3],
|
||||
Dropout: parsed[4],
|
||||
}
|
||||
ret = append(ret, n)
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func IOCounters(pernic bool) ([]IOCountersStat, error) {
|
||||
return IOCountersWithContext(context.Background(), pernic)
|
||||
}
|
||||
|
||||
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) {
|
||||
out, err := invoke.CommandWithContext(ctx, "netstat", "-idn")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
iocounters, err := parseNetstatI(string(out))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if pernic == false {
|
||||
return getIOCountersAll(iocounters)
|
||||
}
|
||||
return iocounters, nil
|
||||
}
|
||||
|
||||
// IOCountersByFile exists just for compatibility with Linux.
|
||||
func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
|
||||
return IOCountersByFileWithContext(context.Background(), pernic, filename)
|
||||
|
36
vendor/github.com/shirou/gopsutil/v3/net/net_aix_cgo.go
generated
vendored
Normal file
36
vendor/github.com/shirou/gopsutil/v3/net/net_aix_cgo.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
//go:build aix && cgo
|
||||
// +build aix,cgo
|
||||
|
||||
package net
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/power-devops/perfstat"
|
||||
)
|
||||
|
||||
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) {
|
||||
ifs, err := perfstat.NetIfaceStat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
iocounters := make([]IOCountersStat, 0, len(ifs))
|
||||
for _, netif := range ifs {
|
||||
n := IOCountersStat{
|
||||
Name: netif.Name,
|
||||
BytesSent: uint64(netif.OBytes),
|
||||
BytesRecv: uint64(netif.IBytes),
|
||||
PacketsSent: uint64(netif.OPackets),
|
||||
PacketsRecv: uint64(netif.IPackets),
|
||||
Errin: uint64(netif.OErrors),
|
||||
Errout: uint64(netif.IErrors),
|
||||
Dropout: uint64(netif.XmitDrops),
|
||||
}
|
||||
iocounters = append(iocounters, n)
|
||||
}
|
||||
if pernic == false {
|
||||
return getIOCountersAll(iocounters)
|
||||
}
|
||||
return iocounters, nil
|
||||
}
|
95
vendor/github.com/shirou/gopsutil/v3/net/net_aix_nocgo.go
generated
vendored
Normal file
95
vendor/github.com/shirou/gopsutil/v3/net/net_aix_nocgo.go
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
//go:build aix && !cgo
|
||||
// +build aix,!cgo
|
||||
|
||||
package net
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
)
|
||||
|
||||
func parseNetstatI(output string) ([]IOCountersStat, error) {
|
||||
lines := strings.Split(string(output), "\n")
|
||||
ret := make([]IOCountersStat, 0, len(lines)-1)
|
||||
exists := make([]string, 0, len(ret))
|
||||
|
||||
// Check first line is header
|
||||
if len(lines) > 0 && strings.Fields(lines[0])[0] != "Name" {
|
||||
return nil, fmt.Errorf("not a 'netstat -i' output")
|
||||
}
|
||||
|
||||
for _, line := range lines[1:] {
|
||||
values := strings.Fields(line)
|
||||
if len(values) < 1 || values[0] == "Name" {
|
||||
continue
|
||||
}
|
||||
if common.StringsHas(exists, values[0]) {
|
||||
// skip if already get
|
||||
continue
|
||||
}
|
||||
exists = append(exists, values[0])
|
||||
|
||||
if len(values) < 9 {
|
||||
continue
|
||||
}
|
||||
|
||||
base := 1
|
||||
// sometimes Address is omitted
|
||||
if len(values) < 10 {
|
||||
base = 0
|
||||
}
|
||||
|
||||
parsed := make([]uint64, 0, 5)
|
||||
vv := []string{
|
||||
values[base+3], // Ipkts == PacketsRecv
|
||||
values[base+4], // Ierrs == Errin
|
||||
values[base+5], // Opkts == PacketsSent
|
||||
values[base+6], // Oerrs == Errout
|
||||
values[base+8], // Drops == Dropout
|
||||
}
|
||||
|
||||
for _, target := range vv {
|
||||
if target == "-" {
|
||||
parsed = append(parsed, 0)
|
||||
continue
|
||||
}
|
||||
|
||||
t, err := strconv.ParseUint(target, 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
parsed = append(parsed, t)
|
||||
}
|
||||
|
||||
n := IOCountersStat{
|
||||
Name: values[0],
|
||||
PacketsRecv: parsed[0],
|
||||
Errin: parsed[1],
|
||||
PacketsSent: parsed[2],
|
||||
Errout: parsed[3],
|
||||
Dropout: parsed[4],
|
||||
}
|
||||
ret = append(ret, n)
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) {
|
||||
out, err := invoke.CommandWithContext(ctx, "netstat", "-idn")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
iocounters, err := parseNetstatI(string(out))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if pernic == false {
|
||||
return getIOCountersAll(iocounters)
|
||||
}
|
||||
return iocounters, nil
|
||||
}
|
8
vendor/github.com/shirou/gopsutil/v3/net/net_linux.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/v3/net/net_linux.go
generated
vendored
@ -721,9 +721,13 @@ func decodeAddressWithContext(ctx context.Context, family uint32, src string) (A
|
||||
return Addr{}, fmt.Errorf("decode error, %w", err)
|
||||
}
|
||||
var ip net.IP
|
||||
// Assumes this is little_endian
|
||||
|
||||
if family == syscall.AF_INET {
|
||||
ip = net.IP(ReverseWithContext(ctx, decoded))
|
||||
if common.IsLittleEndian() {
|
||||
ip = net.IP(ReverseWithContext(ctx, decoded))
|
||||
} else {
|
||||
ip = net.IP(decoded)
|
||||
}
|
||||
} else { // IPv6
|
||||
ip, err = parseIPv6HexStringWithContext(ctx, decoded)
|
||||
if err != nil {
|
||||
|
236
vendor/github.com/shirou/gopsutil/v3/process/process_darwin_386.go
generated
vendored
236
vendor/github.com/shirou/gopsutil/v3/process/process_darwin_386.go
generated
vendored
@ -1,236 +0,0 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs types_darwin.go
|
||||
|
||||
package process
|
||||
|
||||
const (
|
||||
sizeofPtr = 0x8
|
||||
sizeofShort = 0x2
|
||||
sizeofInt = 0x4
|
||||
sizeofLong = 0x8
|
||||
sizeofLongLong = 0x8
|
||||
)
|
||||
|
||||
type (
|
||||
_C_short int16
|
||||
_C_int int32
|
||||
_C_long int64
|
||||
_C_long_long int64
|
||||
)
|
||||
|
||||
type Timespec struct {
|
||||
Sec int64
|
||||
Nsec int64
|
||||
}
|
||||
|
||||
type Timeval struct {
|
||||
Sec int64
|
||||
Usec int32
|
||||
Pad_cgo_0 [4]byte
|
||||
}
|
||||
|
||||
type Rusage struct {
|
||||
Utime Timeval
|
||||
Stime Timeval
|
||||
Maxrss int64
|
||||
Ixrss int64
|
||||
Idrss int64
|
||||
Isrss int64
|
||||
Minflt int64
|
||||
Majflt int64
|
||||
Nswap int64
|
||||
Inblock int64
|
||||
Oublock int64
|
||||
Msgsnd int64
|
||||
Msgrcv int64
|
||||
Nsignals int64
|
||||
Nvcsw int64
|
||||
Nivcsw int64
|
||||
}
|
||||
|
||||
type Rlimit struct {
|
||||
Cur uint64
|
||||
Max uint64
|
||||
}
|
||||
|
||||
type UGid_t uint32
|
||||
|
||||
type KinfoProc struct {
|
||||
Proc ExternProc
|
||||
Eproc Eproc
|
||||
}
|
||||
|
||||
type Eproc struct {
|
||||
Paddr *uint64
|
||||
Sess *Session
|
||||
Pcred Upcred
|
||||
Ucred Uucred
|
||||
Pad_cgo_0 [4]byte
|
||||
Vm Vmspace
|
||||
Ppid int32
|
||||
Pgid int32
|
||||
Jobc int16
|
||||
Pad_cgo_1 [2]byte
|
||||
Tdev int32
|
||||
Tpgid int32
|
||||
Pad_cgo_2 [4]byte
|
||||
Tsess *Session
|
||||
Wmesg [8]int8
|
||||
Xsize int32
|
||||
Xrssize int16
|
||||
Xccount int16
|
||||
Xswrss int16
|
||||
Pad_cgo_3 [2]byte
|
||||
Flag int32
|
||||
Login [12]int8
|
||||
Spare [4]int32
|
||||
Pad_cgo_4 [4]byte
|
||||
}
|
||||
|
||||
type Proc struct{}
|
||||
|
||||
type Session struct{}
|
||||
|
||||
type ucred struct {
|
||||
Link _Ctype_struct___0
|
||||
Ref uint64
|
||||
Posix Posix_cred
|
||||
Label *Label
|
||||
Audit Au_session
|
||||
}
|
||||
|
||||
type Uucred struct {
|
||||
Ref int32
|
||||
UID uint32
|
||||
Ngroups int16
|
||||
Pad_cgo_0 [2]byte
|
||||
Groups [16]uint32
|
||||
}
|
||||
|
||||
type Upcred struct {
|
||||
Pc_lock [72]int8
|
||||
Pc_ucred *ucred
|
||||
P_ruid uint32
|
||||
P_svuid uint32
|
||||
P_rgid uint32
|
||||
P_svgid uint32
|
||||
P_refcnt int32
|
||||
Pad_cgo_0 [4]byte
|
||||
}
|
||||
|
||||
type Vmspace struct {
|
||||
Dummy int32
|
||||
Pad_cgo_0 [4]byte
|
||||
Dummy2 *int8
|
||||
Dummy3 [5]int32
|
||||
Pad_cgo_1 [4]byte
|
||||
Dummy4 [3]*int8
|
||||
}
|
||||
|
||||
type Sigacts struct{}
|
||||
|
||||
type ExternProc struct {
|
||||
P_un [16]byte
|
||||
P_vmspace uint64
|
||||
P_sigacts uint64
|
||||
Pad_cgo_0 [3]byte
|
||||
P_flag int32
|
||||
P_stat int8
|
||||
P_pid int32
|
||||
P_oppid int32
|
||||
P_dupfd int32
|
||||
Pad_cgo_1 [4]byte
|
||||
User_stack uint64
|
||||
Exit_thread uint64
|
||||
P_debugger int32
|
||||
Sigwait int32
|
||||
P_estcpu uint32
|
||||
P_cpticks int32
|
||||
P_pctcpu uint32
|
||||
Pad_cgo_2 [4]byte
|
||||
P_wchan uint64
|
||||
P_wmesg uint64
|
||||
P_swtime uint32
|
||||
P_slptime uint32
|
||||
P_realtimer Itimerval
|
||||
P_rtime Timeval
|
||||
P_uticks uint64
|
||||
P_sticks uint64
|
||||
P_iticks uint64
|
||||
P_traceflag int32
|
||||
Pad_cgo_3 [4]byte
|
||||
P_tracep uint64
|
||||
P_siglist int32
|
||||
Pad_cgo_4 [4]byte
|
||||
P_textvp uint64
|
||||
P_holdcnt int32
|
||||
P_sigmask uint32
|
||||
P_sigignore uint32
|
||||
P_sigcatch uint32
|
||||
P_priority uint8
|
||||
P_usrpri uint8
|
||||
P_nice int8
|
||||
P_comm [17]int8
|
||||
Pad_cgo_5 [4]byte
|
||||
P_pgrp uint64
|
||||
P_addr uint64
|
||||
P_xstat uint16
|
||||
P_acflag uint16
|
||||
Pad_cgo_6 [4]byte
|
||||
P_ru uint64
|
||||
}
|
||||
|
||||
type Itimerval struct {
|
||||
Interval Timeval
|
||||
Value Timeval
|
||||
}
|
||||
|
||||
type Vnode struct{}
|
||||
|
||||
type Pgrp struct{}
|
||||
|
||||
type UserStruct struct{}
|
||||
|
||||
type Au_session struct {
|
||||
Aia_p *AuditinfoAddr
|
||||
Mask AuMask
|
||||
}
|
||||
|
||||
type Posix_cred struct {
|
||||
UID uint32
|
||||
Ruid uint32
|
||||
Svuid uint32
|
||||
Ngroups int16
|
||||
Pad_cgo_0 [2]byte
|
||||
Groups [16]uint32
|
||||
Rgid uint32
|
||||
Svgid uint32
|
||||
Gmuid uint32
|
||||
Flags int32
|
||||
}
|
||||
|
||||
type Label struct{}
|
||||
|
||||
type AuditinfoAddr struct {
|
||||
Auid uint32
|
||||
Mask AuMask
|
||||
Termid AuTidAddr
|
||||
Asid int32
|
||||
Flags uint64
|
||||
}
|
||||
|
||||
type AuMask struct {
|
||||
Success uint32
|
||||
Failure uint32
|
||||
}
|
||||
|
||||
type AuTidAddr struct {
|
||||
Port int32
|
||||
Type uint32
|
||||
Addr [4]uint32
|
||||
}
|
||||
|
||||
type UcredQueue struct {
|
||||
Next *ucred
|
||||
Prev **ucred
|
||||
}
|
6
vendor/github.com/shirou/gopsutil/v3/process/process_linux.go
generated
vendored
6
vendor/github.com/shirou/gopsutil/v3/process/process_linux.go
generated
vendored
@ -688,9 +688,9 @@ func (p *Process) fillSliceFromCmdlineWithContext(ctx context.Context) ([]string
|
||||
if len(cmdline) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
if cmdline[len(cmdline)-1] == 0 {
|
||||
cmdline = cmdline[:len(cmdline)-1]
|
||||
}
|
||||
|
||||
cmdline = bytes.TrimRight(cmdline, "\x00")
|
||||
|
||||
parts := bytes.Split(cmdline, []byte{0})
|
||||
var strParts []string
|
||||
for _, p := range parts {
|
||||
|
10
vendor/github.com/shirou/gopsutil/v3/process/process_windows.go
generated
vendored
10
vendor/github.com/shirou/gopsutil/v3/process/process_windows.go
generated
vendored
@ -285,8 +285,7 @@ func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) {
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
const STILL_ACTIVE = 259 // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getexitcodeprocess
|
||||
h, err := windows.OpenProcess(processQueryInformation, false, uint32(pid))
|
||||
h, err := windows.OpenProcess(windows.SYNCHRONIZE, false, uint32(pid))
|
||||
if err == windows.ERROR_ACCESS_DENIED {
|
||||
return true, nil
|
||||
}
|
||||
@ -296,10 +295,9 @@ func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) {
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer syscall.CloseHandle(syscall.Handle(h))
|
||||
var exitCode uint32
|
||||
err = windows.GetExitCodeProcess(h, &exitCode)
|
||||
return exitCode == STILL_ACTIVE, err
|
||||
defer windows.CloseHandle(h)
|
||||
event, err := windows.WaitForSingleObject(h, 0)
|
||||
return event == uint32(windows.WAIT_TIMEOUT), err
|
||||
}
|
||||
|
||||
func (p *Process) PpidWithContext(ctx context.Context) (int32, error) {
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -10,7 +10,7 @@ github.com/keybase/go-ps/darwincgo
|
||||
github.com/lufia/plan9stats
|
||||
# github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c
|
||||
github.com/power-devops/perfstat
|
||||
# github.com/shirou/gopsutil/v3 v3.22.4
|
||||
# github.com/shirou/gopsutil/v3 v3.22.7
|
||||
github.com/shirou/gopsutil/v3/cpu
|
||||
github.com/shirou/gopsutil/v3/internal/common
|
||||
github.com/shirou/gopsutil/v3/mem
|
||||
|
Loading…
x
Reference in New Issue
Block a user