Skip to content

Commit

Permalink
Add iota for incremental data
Browse files Browse the repository at this point in the history
  • Loading branch information
mo1ein committed Aug 24, 2023
1 parent 8ec7cec commit a0955a9
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 94 deletions.
26 changes: 13 additions & 13 deletions internal/go-ole/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ const (
)

const (
DISPATCH_METHOD = 1
DISPATCH_PROPERTYGET = 2
DISPATCH_PROPERTYPUT = 4
DISPATCH_PROPERTYPUTREF = 8
DISPATCH_METHOD = 1 << iota
DISPATCH_PROPERTYGET
DISPATCH_PROPERTYPUT
DISPATCH_PROPERTYPUTREF
)

const (
Expand Down Expand Up @@ -124,15 +124,15 @@ const (
)

const (
TKIND_ENUM = 1
TKIND_RECORD = 2
TKIND_MODULE = 3
TKIND_INTERFACE = 4
TKIND_DISPATCH = 5
TKIND_COCLASS = 6
TKIND_ALIAS = 7
TKIND_UNION = 8
TKIND_MAX = 9
TKIND_ENUM = iota + 1
TKIND_RECORD
TKIND_MODULE
TKIND_INTERFACE
TKIND_DISPATCH
TKIND_COCLASS
TKIND_ALIAS
TKIND_UNION
TKIND_MAX
)

// Safe Array Feature Flags
Expand Down
12 changes: 6 additions & 6 deletions internal/gopsutil/cpu/cpu_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import (

// sys/resource.h
const (
CPUser = 0
CPNice = 1
CPSys = 2
CPIntr = 3
CPIdle = 4
CPUStates = 5
CPUser = iota
CPNice
CPSys
CPIntr
CPIdle
CPUStates
)

// default value. from time.h
Expand Down
18 changes: 9 additions & 9 deletions internal/gopsutil/cpu/cpu_solaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ func parseISAInfo(cmdOutput string) ([]string, error) {
var psrInfoMatch = regexp.MustCompile(`The physical processor has (?:([\d]+) virtual processor \(([\d]+)\)|([\d]+) cores and ([\d]+) virtual processors[^\n]+)\n(?:\s+ The core has.+\n)*\s+.+ \((\w+) ([\S]+) family (.+) model (.+) step (.+) clock (.+) MHz\)\n[\s]*(.*)`)

const (
psrNumCoresOffset = 1
psrNumCoresHTOffset = 3
psrNumHTOffset = 4
psrVendorIDOffset = 5
psrFamilyOffset = 7
psrModelOffset = 8
psrStepOffset = 9
psrClockOffset = 10
psrModelNameOffset = 11
psrNumCoresOffset = iota + 1
psrNumCoresHTOffset
psrNumHTOffset
psrVendorIDOffset
psrFamilyOffset
psrModelOffset
psrStepOffset
psrClockOffset
psrModelNameOffset
)

func parseProcessorInfo(cmdOutput string) ([]InfoStat, error) {
Expand Down
34 changes: 17 additions & 17 deletions internal/gopsutil/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,22 @@ type PageFaultsStat struct {
// Resource limit constants are from /usr/include/x86_64-linux-gnu/bits/resource.h
// from libc6-dev package in Ubuntu 16.10
const (
RLIMIT_CPU int32 = 0
RLIMIT_FSIZE int32 = 1
RLIMIT_DATA int32 = 2
RLIMIT_STACK int32 = 3
RLIMIT_CORE int32 = 4
RLIMIT_RSS int32 = 5
RLIMIT_NPROC int32 = 6
RLIMIT_NOFILE int32 = 7
RLIMIT_MEMLOCK int32 = 8
RLIMIT_AS int32 = 9
RLIMIT_LOCKS int32 = 10
RLIMIT_SIGPENDING int32 = 11
RLIMIT_MSGQUEUE int32 = 12
RLIMIT_NICE int32 = 13
RLIMIT_RTPRIO int32 = 14
RLIMIT_RTTIME int32 = 15
RLIMIT_CPU int32 = iota
RLIMIT_FSIZE
RLIMIT_DATA
RLIMIT_STACK
RLIMIT_CORE
RLIMIT_RSS
RLIMIT_NPROC
RLIMIT_NOFILE
RLIMIT_MEMLOCK
RLIMIT_AS
RLIMIT_LOCKS
RLIMIT_SIGPENDING
RLIMIT_MSGQUEUE
RLIMIT_NICE
RLIMIT_RTPRIO
RLIMIT_RTTIME
)

func (p Process) String() string {
Expand Down Expand Up @@ -288,7 +288,7 @@ func (p *Process) MemoryPercentWithContext(ctx context.Context) (float32, error)
}
used := processMemory.RSS

return (100 * float32(used) / float32(total)), nil
return 100 * float32(used) / float32(total), nil
}

// CPU_Percent returns how many percent of the CPU time this process uses
Expand Down
14 changes: 7 additions & 7 deletions internal/gopsutil/process/process_freebsd_386.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ const (
)

const (
SIDL = 1
SRUN = 2
SSLEEP = 3
SSTOP = 4
SZOMB = 5
SWAIT = 6
SLOCK = 7
SIDL = iota + 1
SRUN
SSLEEP
SSTOP
SZOMB
SWAIT
SLOCK
)

type (
Expand Down
14 changes: 7 additions & 7 deletions internal/gopsutil/process/process_freebsd_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ const (
)

const (
SIDL = 1
SRUN = 2
SSLEEP = 3
SSTOP = 4
SZOMB = 5
SWAIT = 6
SLOCK = 7
SIDL = iota + 1
SRUN
SSLEEP
SSTOP
SZOMB
SWAIT
SLOCK
)

type (
Expand Down
14 changes: 7 additions & 7 deletions internal/gopsutil/process/process_freebsd_arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ const (
)

const (
SIDL = 1
SRUN = 2
SSLEEP = 3
SSTOP = 4
SZOMB = 5
SWAIT = 6
SLOCK = 7
SIDL = iota + 1
SRUN
SSLEEP
SSTOP
SZOMB
SWAIT
SLOCK
)

type (
Expand Down
14 changes: 7 additions & 7 deletions internal/gopsutil/process/process_freebsd_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions internal/gopsutil/process/process_openbsd_386.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions internal/gopsutil/process/process_openbsd_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ const (
)

const (
SIDL = 1
SRUN = 2
SSLEEP = 3
SSTOP = 4
SZOMB = 5
SDEAD = 6
SONPROC = 7
SIDL = iota + 1
SRUN
SSLEEP
SSTOP
SZOMB
SDEAD
SONPROC
)

type (
Expand Down
14 changes: 7 additions & 7 deletions internal/gopsutil/process/types_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ const (

// from sys/proc.h
const (
SIDL = 1 /* Process being created by fork. */
SRUN = 2 /* Currently runnable. */
SSLEEP = 3 /* Sleeping on an address. */
SSTOP = 4 /* Process debugging or suspension. */
SZOMB = 5 /* Awaiting collection by parent. */
SDEAD = 6 /* Thread is almost gone */
SONPROC = 7 /* Thread is currently on a CPU. */
SIDL = iota + 1 /* Process being created by fork. */
SRUN /* Currently runnable. */
SSLEEP /* Sleeping on an address. */
SSTOP /* Process debugging or suspension. */
SZOMB /* Awaiting a collection by parent. */
SDEAD /* Thread is almost gone */
SONPROC /* Thread is currently on a CPU. */
)

// Basic types
Expand Down

0 comments on commit a0955a9

Please sign in to comment.