utils

package
v0.0.0-...-ac4ab60 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = "2018-11-04 16:22:35 +0800 @de1ad026e329561c22e2a3035fbfe89dc7fef764 @3.2.2-12-gde1ad026"
	Compile = "2022-01-05 09:55:50 +0800 by go version go1.17.5 darwin/amd64"
)

Variables

View Source
var (
	Hostname, _ = os.Hostname()

	HostIPs, InterfaceIPs []string
)

Functions

func Argument

func Argument(d map[string]interface{}, name string) (string, bool)

func ArgumentInteger

func ArgumentInteger(d map[string]interface{}, name string) (int, bool)

func ArgumentIntegerMust

func ArgumentIntegerMust(d map[string]interface{}, name string) int

func ArgumentMust

func ArgumentMust(d map[string]interface{}, name string) string

func LookupIP

func LookupIP(host string) []net.IP

func LookupIPTimeout

func LookupIPTimeout(host string, timeout time.Duration) []net.IP

func ReplaceUnspecifiedIP

func ReplaceUnspecifiedIP(network string, listenAddr, globalAddr string) (string, error)

func ResolveTCPAddr

func ResolveTCPAddr(addr string) *net.TCPAddr

func ResolveTCPAddrTimeout

func ResolveTCPAddrTimeout(addr string, timeout time.Duration) *net.TCPAddr

Types

type Usage

type Usage struct {
	Utime  time.Duration `json:"utime"`
	Stime  time.Duration `json:"stime"`
	Cutime time.Duration `json:"cutime"`
	Cstime time.Duration `json:"cstime"`

	NumThreads int `json:"num_threads"`

	VmSize int64 `json:"vm_size"`
	VmRss  int64 `json:"vm_rss"`
}

func CPUUsage

func CPUUsage(d time.Duration) (float64, *Usage, error)

func GetUsage

func GetUsage() (*Usage, error)

func (*Usage) CPUTotal

func (u *Usage) CPUTotal() time.Duration

func (*Usage) MemTotal

func (u *Usage) MemTotal() int64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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