psutil

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TCP = "tcp"
	UDP = "udp"
)

Variables

This section is empty.

Functions

func CPUCount added in v1.0.1

func CPUCount() int

func CPUInfo added in v1.0.1

func CPUInfo() []cpu.InfoStat

func GetArch added in v1.0.1

func GetArch() string

func GetHostname added in v1.0.1

func GetHostname() string

func GetMemUsed added in v1.0.1

func GetMemUsed() uint64

func GetMemUsedPercent added in v1.0.1

func GetMemUsedPercent() float64

func GetOS added in v1.0.1

func GetOS() string

func GetPlatform added in v1.0.1

func GetPlatform() string

func GetPlatformVersion added in v1.0.1

func GetPlatformVersion() string

func GetProcStat

func GetProcStat(pid int) ([]string, error)
GetProcStat

Description:

will try to get process's state if it is existed. when process does not exist, the function will return an error.

Returns:

[]string: Status returns the process status. Return value could be one of these.
          R: Running S: Sleep T: Stop I: Idle Z: Zombie W: Wait L: Lock The character

func GetSwapTotal added in v1.0.1

func GetSwapTotal() uint64

func GetSwapUsed added in v1.0.1

func GetSwapUsed() uint64

func GetSwapUsedPercent added in v1.0.1

func GetSwapUsedPercent() float64

func GetTotalMem added in v1.0.1

func GetTotalMem() uint64

func IsAix added in v1.0.1

func IsAix() bool

func IsArch64 added in v1.0.1

func IsArch64() bool

func IsContainer added in v1.0.1

func IsContainer() bool

func IsDarwin added in v1.0.1

func IsDarwin() bool

func IsFreeBsd added in v1.0.1

func IsFreeBsd() bool

func IsLinux added in v1.0.1

func IsLinux() bool

func IsOpenBsd added in v1.0.1

func IsOpenBsd() bool

func IsSmartOs added in v1.0.1

func IsSmartOs() bool

func IsSunOs added in v1.0.1

func IsSunOs() bool

func IsWindows added in v1.0.1

func IsWindows() bool

func IsX86 added in v1.0.1

func IsX86() bool

func PerCPUPercent added in v1.0.1

func PerCPUPercent() []float64

func TerminateProcess

func TerminateProcess(pid int, timeout int, force bool) error
TerminateWithPidFile

Description:

will try reading pid file and terminate the process.

Args:

timeout: max second waiting termination.
force: whether using signal.SIGKILL when signal.SIGTERM failed.

func TerminateWithPidFile

func TerminateWithPidFile(path string, timeout int, force bool) error
TerminateWithPidFile

Description:

will try reading pid file and terminate the process.

Args:

path: pid file path.
timeout: max second waiting termination.
force: whether using signal.SIGKILL when signal.SIGTERM failed.

func TotalCPUPercent added in v1.0.1

func TotalCPUPercent() []float64

func VCPUCount added in v1.0.1

func VCPUCount() int

Types

type ScanPort added in v1.0.1

type ScanPort struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewScanPort added in v1.0.1

func NewScanPort(ipString string, ports []int, timeoutMillSecond int, protocol string) (*ScanPort, error)

func (*ScanPort) Scan added in v1.0.1

func (s *ScanPort) Scan() map[int]int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL