utils

package
v0.0.0-...-de1ad02 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2018 License: MIT Imports: 11 Imported by: 56

Documentation

Index

Constants

This section is empty.

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