mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-09 01:53:56 +00:00
update process mod pkg
This commit is contained in:
parent
b120479bcb
commit
76fa65b35a
2
go.mod
2
go.mod
@ -8,7 +8,7 @@ require (
|
||||
github.com/lxn/win v0.0.0-20190226192825-50e22abd4ff9
|
||||
github.com/otiai10/gosseract v2.2.1+incompatible
|
||||
github.com/robotn/gohook v0.0.0-20190227143424-9bf349ed0b6d
|
||||
github.com/shirou/gopsutil v2.18.12+incompatible
|
||||
github.com/shirou/gopsutil v0.0.0-20190131151121-071446942108
|
||||
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
|
||||
github.com/vcaesar/imgo v0.0.0-20181209162409-13af122cf2fa
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067 // indirect
|
||||
|
2
go.sum
2
go.sum
@ -16,6 +16,8 @@ github.com/otiai10/gosseract v2.2.1+incompatible h1:Ry5ltVdpdp4LAa2bMjsSJH34XHVO
|
||||
github.com/otiai10/gosseract v2.2.1+incompatible/go.mod h1:XrzWItCzCpFRZ35n3YtVTgq5bLAhFIkascoRo8G32QE=
|
||||
github.com/robotn/gohook v0.0.0-20190227143424-9bf349ed0b6d h1:AYuqgHF+CzRt+kNH7MVXu6GL8CEScvlIkmBO7cpaMAo=
|
||||
github.com/robotn/gohook v0.0.0-20190227143424-9bf349ed0b6d/go.mod h1:YD5RyCnUEY2xqtkkgeQVZ31UAfAnVPwUxpTE5cwSXg4=
|
||||
github.com/shirou/gopsutil v0.0.0-20190131151121-071446942108 h1:XXgDK65TPH+Qbo2sdYHldM5avclwThBXVYZHxroFkTQ=
|
||||
github.com/shirou/gopsutil v0.0.0-20190131151121-071446942108/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/shirou/gopsutil v2.18.12+incompatible h1:1eaJvGomDnH74/5cF4CTmTbLHAriGFsTZppLXDX93OM=
|
||||
github.com/shirou/gopsutil v2.18.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U=
|
||||
|
9
vendor/github.com/shirou/gopsutil/cpu/cpu_freebsd_arm.go
generated
vendored
Normal file
9
vendor/github.com/shirou/gopsutil/cpu/cpu_freebsd_arm.go
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
package cpu
|
||||
|
||||
type cpuTimes struct {
|
||||
User uint32
|
||||
Nice uint32
|
||||
Sys uint32
|
||||
Intr uint32
|
||||
Idle uint32
|
||||
}
|
38
vendor/github.com/shirou/gopsutil/cpu/cpu_openbsd.go
generated
vendored
38
vendor/github.com/shirou/gopsutil/cpu/cpu_openbsd.go
generated
vendored
@ -16,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
// sys/sched.h
|
||||
const (
|
||||
var (
|
||||
CPUser = 0
|
||||
CPNice = 1
|
||||
CPSys = 2
|
||||
@ -35,6 +35,7 @@ const (
|
||||
var ClocksPerSec = float64(128)
|
||||
|
||||
func init() {
|
||||
func() {
|
||||
getconf, err := exec.LookPath("/usr/bin/getconf")
|
||||
if err != nil {
|
||||
return
|
||||
@ -47,6 +48,23 @@ func init() {
|
||||
ClocksPerSec = float64(i)
|
||||
}
|
||||
}
|
||||
}()
|
||||
func() {
|
||||
v, err := unix.Sysctl("kern.osrelease") // can't reuse host.PlatformInformation because of circular import
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
v = strings.ToLower(v)
|
||||
version, err := strconv.ParseFloat(v, 64)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if version >= 6.4 {
|
||||
CPIntr = 4
|
||||
CPIdle = 5
|
||||
CPUStates = 6
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func Times(percpu bool) ([]TimesStat, error) {
|
||||
@ -64,7 +82,7 @@ func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
|
||||
}
|
||||
|
||||
for i := 0; i < ncpu; i++ {
|
||||
var cpuTimes [CPUStates]int64
|
||||
var cpuTimes = make([]int64, CPUStates)
|
||||
var mib []int32
|
||||
if percpu {
|
||||
mib = []int32{CTLKern, KernCptime}
|
||||
@ -106,14 +124,24 @@ func Info() ([]InfoStat, error) {
|
||||
|
||||
func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
|
||||
var ret []InfoStat
|
||||
var err error
|
||||
|
||||
c := InfoStat{}
|
||||
|
||||
v, err := unix.Sysctl("hw.model")
|
||||
if err != nil {
|
||||
var u32 uint32
|
||||
if u32, err = unix.SysctlUint32("hw.cpuspeed"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.Mhz = float64(u32)
|
||||
|
||||
if u32, err = unix.SysctlUint32("hw.ncpuonline"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.Cores = int32(u32)
|
||||
|
||||
if c.ModelName, err = unix.Sysctl("hw.model"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.ModelName = v
|
||||
|
||||
return append(ret, c), nil
|
||||
}
|
||||
|
23
vendor/github.com/shirou/gopsutil/host/host_darwin.go
generated
vendored
23
vendor/github.com/shirou/gopsutil/host/host_darwin.go
generated
vendored
@ -18,6 +18,7 @@ import (
|
||||
|
||||
"github.com/shirou/gopsutil/internal/common"
|
||||
"github.com/shirou/gopsutil/process"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// from utmpx.h
|
||||
@ -180,17 +181,13 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string
|
||||
if err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
uname, err := exec.LookPath("uname")
|
||||
if err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
|
||||
out, err := invoke.CommandWithContext(ctx, uname, "-s")
|
||||
p, err := unix.Sysctl("kern.ostype")
|
||||
if err == nil {
|
||||
platform = strings.ToLower(strings.TrimSpace(string(out)))
|
||||
platform = strings.ToLower(p)
|
||||
}
|
||||
|
||||
out, err = invoke.CommandWithContext(ctx, sw_vers, "-productVersion")
|
||||
out, err := invoke.CommandWithContext(ctx, sw_vers, "-productVersion")
|
||||
if err == nil {
|
||||
pver = strings.ToLower(strings.TrimSpace(string(out)))
|
||||
}
|
||||
@ -211,16 +208,8 @@ func KernelVersion() (string, error) {
|
||||
}
|
||||
|
||||
func KernelVersionWithContext(ctx context.Context) (string, error) {
|
||||
uname, err := exec.LookPath("uname")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
out, err := invoke.CommandWithContext(ctx, uname, "-r")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
version := strings.ToLower(strings.TrimSpace(string(out)))
|
||||
return version, err
|
||||
version, err := unix.Sysctl("kern.osrelease")
|
||||
return strings.ToLower(version), err
|
||||
}
|
||||
|
||||
func SensorsTemperatures() ([]TemperatureStat, error) {
|
||||
|
15
vendor/github.com/shirou/gopsutil/host/host_openbsd.go
generated
vendored
15
vendor/github.com/shirou/gopsutil/host/host_openbsd.go
generated
vendored
@ -8,7 +8,6 @@ import (
|
||||
"encoding/binary"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -17,6 +16,7 @@ import (
|
||||
|
||||
"github.com/shirou/gopsutil/internal/common"
|
||||
"github.com/shirou/gopsutil/process"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -108,19 +108,14 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string
|
||||
platform := ""
|
||||
family := ""
|
||||
version := ""
|
||||
uname, err := exec.LookPath("uname")
|
||||
if err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
|
||||
out, err := invoke.CommandWithContext(ctx, uname, "-s")
|
||||
p, err := unix.Sysctl("kern.ostype")
|
||||
if err == nil {
|
||||
platform = strings.ToLower(strings.TrimSpace(string(out)))
|
||||
platform = strings.ToLower(p)
|
||||
}
|
||||
|
||||
out, err = invoke.CommandWithContext(ctx, uname, "-r")
|
||||
v, err := unix.Sysctl("kern.osrelease")
|
||||
if err == nil {
|
||||
version = strings.ToLower(strings.TrimSpace(string(out)))
|
||||
version = strings.ToLower(v)
|
||||
}
|
||||
|
||||
return platform, family, version, nil
|
||||
|
8
vendor/github.com/shirou/gopsutil/process/process.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/process/process.go
generated
vendored
@ -43,6 +43,7 @@ type OpenFilesStat struct {
|
||||
type MemoryInfoStat struct {
|
||||
RSS uint64 `json:"rss"` // bytes
|
||||
VMS uint64 `json:"vms"` // bytes
|
||||
HWM uint64 `json:"hwm"` // bytes
|
||||
Data uint64 `json:"data"` // bytes
|
||||
Stack uint64 `json:"stack"` // bytes
|
||||
Locked uint64 `json:"locked"` // bytes
|
||||
@ -76,6 +77,13 @@ type NumCtxSwitchesStat struct {
|
||||
Involuntary int64 `json:"involuntary"`
|
||||
}
|
||||
|
||||
type PageFaultsStat struct {
|
||||
MinorFaults uint64 `json:"minorFaults"`
|
||||
MajorFaults uint64 `json:"majorFaults"`
|
||||
ChildMinorFaults uint64 `json:"childMinorFaults"`
|
||||
ChildMajorFaults uint64 `json:"childMajorFaults"`
|
||||
}
|
||||
|
||||
// Resource limit constants are from /usr/include/x86_64-linux-gnu/bits/resource.h
|
||||
// from libc6-dev package in Ubuntu 16.10
|
||||
const (
|
||||
|
8
vendor/github.com/shirou/gopsutil/process/process_darwin.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/process/process_darwin.go
generated
vendored
@ -481,6 +481,14 @@ func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExSta
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) PageFaults() (*PageFaultsStat, error) {
|
||||
return p.PageFaultsWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) Children() ([]*Process, error) {
|
||||
return p.ChildrenWithContext(context.Background())
|
||||
}
|
||||
|
6
vendor/github.com/shirou/gopsutil/process/process_fallback.go
generated
vendored
6
vendor/github.com/shirou/gopsutil/process/process_fallback.go
generated
vendored
@ -233,6 +233,12 @@ func (p *Process) MemoryInfoEx() (*MemoryInfoExStat, error) {
|
||||
func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
func (p *Process) PageFaults() (*PageFaultsStat, error) {
|
||||
return p.PageFaultsWithContext(context.Background())
|
||||
}
|
||||
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
func (p *Process) Children() ([]*Process, error) {
|
||||
return p.ChildrenWithContext(context.Background())
|
||||
}
|
||||
|
8
vendor/github.com/shirou/gopsutil/process/process_freebsd.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/process/process_freebsd.go
generated
vendored
@ -371,6 +371,14 @@ func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExSta
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) PageFaults() (*PageFaultsStat, error) {
|
||||
return p.PageFaultsWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) Children() ([]*Process, error) {
|
||||
return p.ChildrenWithContext(context.Background())
|
||||
}
|
||||
|
99
vendor/github.com/shirou/gopsutil/process/process_linux.go
generated
vendored
99
vendor/github.com/shirou/gopsutil/process/process_linux.go
generated
vendored
@ -84,7 +84,7 @@ func (p *Process) Ppid() (int32, error) {
|
||||
}
|
||||
|
||||
func (p *Process) PpidWithContext(ctx context.Context) (int32, error) {
|
||||
_, ppid, _, _, _, _, err := p.fillFromStat()
|
||||
_, ppid, _, _, _, _, _, err := p.fillFromStat()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
@ -150,7 +150,7 @@ func (p *Process) CreateTime() (int64, error) {
|
||||
}
|
||||
|
||||
func (p *Process) CreateTimeWithContext(ctx context.Context) (int64, error) {
|
||||
_, _, _, createTime, _, _, err := p.fillFromStat()
|
||||
_, _, _, createTime, _, _, _, err := p.fillFromStat()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@ -253,7 +253,7 @@ func (p *Process) Terminal() (string, error) {
|
||||
}
|
||||
|
||||
func (p *Process) TerminalWithContext(ctx context.Context) (string, error) {
|
||||
t, _, _, _, _, _, err := p.fillFromStat()
|
||||
t, _, _, _, _, _, _, err := p.fillFromStat()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@ -272,7 +272,7 @@ func (p *Process) Nice() (int32, error) {
|
||||
}
|
||||
|
||||
func (p *Process) NiceWithContext(ctx context.Context) (int32, error) {
|
||||
_, _, _, _, _, nice, err := p.fillFromStat()
|
||||
_, _, _, _, _, nice, _, err := p.fillFromStat()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@ -310,7 +310,7 @@ func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) (
|
||||
return rlimits, err
|
||||
}
|
||||
|
||||
_, _, _, _, rtprio, nice, err := p.fillFromStat()
|
||||
_, _, _, _, rtprio, nice, _, err := p.fillFromStat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -418,7 +418,7 @@ func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesS
|
||||
}
|
||||
|
||||
for _, tid := range tids {
|
||||
_, _, cpuTimes, _, _, _, err := p.fillFromTIDStat(tid)
|
||||
_, _, cpuTimes, _, _, _, _, err := p.fillFromTIDStat(tid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -434,7 +434,7 @@ func (p *Process) Times() (*cpu.TimesStat, error) {
|
||||
}
|
||||
|
||||
func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) {
|
||||
_, _, cpuTimes, _, _, _, err := p.fillFromStat()
|
||||
_, _, cpuTimes, _, _, _, _, err := p.fillFromStat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -478,6 +478,20 @@ func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExSta
|
||||
return memInfoEx, nil
|
||||
}
|
||||
|
||||
// PageFaultsInfo returns the process's page fault counters
|
||||
func (p *Process) PageFaults() (*PageFaultsStat, error) {
|
||||
return p.PageFaultsWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) {
|
||||
_, _, _, _, _, _, pageFaults, err := p.fillFromStat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return pageFaults, nil
|
||||
|
||||
}
|
||||
|
||||
// Children returns a slice of Process of the process.
|
||||
func (p *Process) Children() ([]*Process, error) {
|
||||
return p.ChildrenWithContext(context.Background())
|
||||
@ -559,6 +573,9 @@ func (p *Process) MemoryMaps(grouped bool) (*[]MemoryMapsStat, error) {
|
||||
func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) {
|
||||
pid := p.Pid
|
||||
var ret []MemoryMapsStat
|
||||
if grouped {
|
||||
ret = make([]MemoryMapsStat, 1)
|
||||
}
|
||||
smapsPath := common.HostProc(strconv.Itoa(int(pid)), "smaps")
|
||||
contents, err := ioutil.ReadFile(smapsPath)
|
||||
if err != nil {
|
||||
@ -621,8 +638,21 @@ func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]M
|
||||
if err != nil {
|
||||
return &ret, err
|
||||
}
|
||||
if grouped {
|
||||
ret[0].Size += g.Size
|
||||
ret[0].Rss += g.Rss
|
||||
ret[0].Pss += g.Pss
|
||||
ret[0].SharedClean += g.SharedClean
|
||||
ret[0].SharedDirty += g.SharedDirty
|
||||
ret[0].PrivateClean += g.PrivateClean
|
||||
ret[0].PrivateDirty += g.PrivateDirty
|
||||
ret[0].Referenced += g.Referenced
|
||||
ret[0].Anonymous += g.Anonymous
|
||||
ret[0].Swap += g.Swap
|
||||
} else {
|
||||
ret = append(ret, g)
|
||||
}
|
||||
}
|
||||
// starts new block
|
||||
blocks = make([]string, 16)
|
||||
} else {
|
||||
@ -1083,6 +1113,13 @@ func (p *Process) fillFromStatusWithContext(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
p.memInfo.Swap = v * 1024
|
||||
case "VmHWM":
|
||||
value := strings.Trim(value, " kB") // remove last "kB"
|
||||
v, err := strconv.ParseUint(value, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
p.memInfo.HWM = v * 1024
|
||||
case "VmData":
|
||||
value := strings.Trim(value, " kB") // remove last "kB"
|
||||
v, err := strconv.ParseUint(value, 10, 64)
|
||||
@ -1140,11 +1177,11 @@ func (p *Process) fillFromStatusWithContext(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Process) fillFromTIDStat(tid int32) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, error) {
|
||||
func (p *Process) fillFromTIDStat(tid int32) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, *PageFaultsStat, error) {
|
||||
return p.fillFromTIDStatWithContext(context.Background(), tid)
|
||||
}
|
||||
|
||||
func (p *Process) fillFromTIDStatWithContext(ctx context.Context, tid int32) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, error) {
|
||||
func (p *Process) fillFromTIDStatWithContext(ctx context.Context, tid int32) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, *PageFaultsStat, error) {
|
||||
pid := p.Pid
|
||||
var statPath string
|
||||
|
||||
@ -1156,7 +1193,7 @@ func (p *Process) fillFromTIDStatWithContext(ctx context.Context, tid int32) (ui
|
||||
|
||||
contents, err := ioutil.ReadFile(statPath)
|
||||
if err != nil {
|
||||
return 0, 0, nil, 0, 0, 0, err
|
||||
return 0, 0, nil, 0, 0, 0, nil, err
|
||||
}
|
||||
fields := strings.Fields(string(contents))
|
||||
|
||||
@ -1167,21 +1204,21 @@ func (p *Process) fillFromTIDStatWithContext(ctx context.Context, tid int32) (ui
|
||||
|
||||
terminal, err := strconv.ParseUint(fields[i+5], 10, 64)
|
||||
if err != nil {
|
||||
return 0, 0, nil, 0, 0, 0, err
|
||||
return 0, 0, nil, 0, 0, 0, nil, err
|
||||
}
|
||||
|
||||
ppid, err := strconv.ParseInt(fields[i+2], 10, 32)
|
||||
if err != nil {
|
||||
return 0, 0, nil, 0, 0, 0, err
|
||||
return 0, 0, nil, 0, 0, 0, nil, err
|
||||
}
|
||||
utime, err := strconv.ParseFloat(fields[i+12], 64)
|
||||
if err != nil {
|
||||
return 0, 0, nil, 0, 0, 0, err
|
||||
return 0, 0, nil, 0, 0, 0, nil, err
|
||||
}
|
||||
|
||||
stime, err := strconv.ParseFloat(fields[i+13], 64)
|
||||
if err != nil {
|
||||
return 0, 0, nil, 0, 0, 0, err
|
||||
return 0, 0, nil, 0, 0, 0, nil, err
|
||||
}
|
||||
|
||||
cpuTimes := &cpu.TimesStat{
|
||||
@ -1193,14 +1230,14 @@ func (p *Process) fillFromTIDStatWithContext(ctx context.Context, tid int32) (ui
|
||||
bootTime, _ := host.BootTime()
|
||||
t, err := strconv.ParseUint(fields[i+20], 10, 64)
|
||||
if err != nil {
|
||||
return 0, 0, nil, 0, 0, 0, err
|
||||
return 0, 0, nil, 0, 0, 0, nil, err
|
||||
}
|
||||
ctime := (t / uint64(ClockTicks)) + uint64(bootTime)
|
||||
createTime := int64(ctime * 1000)
|
||||
|
||||
rtpriority, err := strconv.ParseInt(fields[i+16], 10, 32)
|
||||
if err != nil {
|
||||
return 0, 0, nil, 0, 0, 0, err
|
||||
return 0, 0, nil, 0, 0, 0, nil, err
|
||||
}
|
||||
if rtpriority < 0 {
|
||||
rtpriority = rtpriority*-1 - 1
|
||||
@ -1213,14 +1250,38 @@ func (p *Process) fillFromTIDStatWithContext(ctx context.Context, tid int32) (ui
|
||||
snice, _ := unix.Getpriority(PrioProcess, int(pid))
|
||||
nice := int32(snice) // FIXME: is this true?
|
||||
|
||||
return terminal, int32(ppid), cpuTimes, createTime, uint32(rtpriority), nice, nil
|
||||
minFault, err := strconv.ParseUint(fields[i+8], 10, 64)
|
||||
if err != nil {
|
||||
return 0, 0, nil, 0, 0, 0, nil, err
|
||||
}
|
||||
cMinFault, err := strconv.ParseUint(fields[i+9], 10, 64)
|
||||
if err != nil {
|
||||
return 0, 0, nil, 0, 0, 0, nil, err
|
||||
}
|
||||
majFault, err := strconv.ParseUint(fields[i+10], 10, 64)
|
||||
if err != nil {
|
||||
return 0, 0, nil, 0, 0, 0, nil, err
|
||||
}
|
||||
cMajFault, err := strconv.ParseUint(fields[i+11], 10, 64)
|
||||
if err != nil {
|
||||
return 0, 0, nil, 0, 0, 0, nil, err
|
||||
}
|
||||
|
||||
faults := &PageFaultsStat{
|
||||
MinorFaults: minFault,
|
||||
MajorFaults: majFault,
|
||||
ChildMinorFaults: cMinFault,
|
||||
ChildMajorFaults: cMajFault,
|
||||
}
|
||||
|
||||
return terminal, int32(ppid), cpuTimes, createTime, uint32(rtpriority), nice, faults, nil
|
||||
}
|
||||
|
||||
func (p *Process) fillFromStat() (uint64, int32, *cpu.TimesStat, int64, uint32, int32, error) {
|
||||
func (p *Process) fillFromStat() (uint64, int32, *cpu.TimesStat, int64, uint32, int32, *PageFaultsStat, error) {
|
||||
return p.fillFromStatWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (p *Process) fillFromStatWithContext(ctx context.Context) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, error) {
|
||||
func (p *Process) fillFromStatWithContext(ctx context.Context) (uint64, int32, *cpu.TimesStat, int64, uint32, int32, *PageFaultsStat, error) {
|
||||
return p.fillFromTIDStat(-1)
|
||||
}
|
||||
|
||||
|
10
vendor/github.com/shirou/gopsutil/process/process_openbsd.go
generated
vendored
10
vendor/github.com/shirou/gopsutil/process/process_openbsd.go
generated
vendored
@ -7,6 +7,8 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
@ -357,6 +359,14 @@ func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExSta
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) PageFaults() (*PageFaultsStat, error) {
|
||||
return p.PageFaultsWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) Children() ([]*Process, error) {
|
||||
return p.ChildrenWithContext(context.Background())
|
||||
}
|
||||
|
8
vendor/github.com/shirou/gopsutil/process/process_windows.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/process/process_windows.go
generated
vendored
@ -530,6 +530,14 @@ func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExSta
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) PageFaults() (*PageFaultsStat, error) {
|
||||
return p.PageFaultsWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) Children() ([]*Process, error) {
|
||||
return p.ChildrenWithContext(context.Background())
|
||||
}
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -19,7 +19,7 @@ github.com/lxn/win
|
||||
github.com/otiai10/gosseract
|
||||
# github.com/robotn/gohook v0.0.0-20190227143424-9bf349ed0b6d
|
||||
github.com/robotn/gohook
|
||||
# github.com/shirou/gopsutil v2.18.12+incompatible
|
||||
# github.com/shirou/gopsutil v0.0.0-20190131151121-071446942108
|
||||
github.com/shirou/gopsutil/process
|
||||
github.com/shirou/gopsutil/cpu
|
||||
github.com/shirou/gopsutil/host
|
||||
|
Loading…
Reference in New Issue
Block a user