utils

package
v0.0.0-...-dafe533 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  = 1
	KB = 1024 * B
	MB = 1024 * KB
	GB = 1024 * MB
)

Variables

This section is empty.

Functions

func CatGoroutineID

func CatGoroutineID() string

func Collect

func Collect(args ...interface{}) []interface{}

func ExternalIP

func ExternalIP() (net.IP, error)

func FmtHookPool

func FmtHookPool(p request.PoolReq) request.Pool

func FmtStack

func FmtStack() (signature string, callerClass string, callerMethod string, callerLineNumber int)

func GetSource

func GetSource(s interface{}) string

func GzipStr

func GzipStr(str string) string

func IsHook

func IsHook(string2 string, line int) (flag bool)

func RangeSource

func RangeSource(i interface{}, needHook *[]interface{})

func RangeStructFiled

func RangeStructFiled(i interface{}, needHook *[]interface{})

func RangeStructMap

func RangeStructMap(i interface{}, needHook *[]interface{})

func RangeStructSlice

func RangeStructSlice(i interface{}, needHook *[]interface{})

func RunMapGCbYGoroutineID

func RunMapGCbYGoroutineID(goroutineIDs map[string]bool)

func StringAdd

func StringAdd(s ...string) string

func Strval

func Strval(value interface{}) string

Types

type Cpu

type Cpu struct {
	Cpus  []float64 `json:"cpus"`
	Cores int       `json:"cores"`
}

func InitCPU

func InitCPU() (c Cpu, err error)

type Disk

type Disk struct {
	UsedMB      int `json:"usedMb"`
	UsedGB      int `json:"usedGb"`
	TotalMB     int `json:"totalMb"`
	TotalGB     int `json:"totalGb"`
	UsedPercent int `json:"usedPercent"`
}

func InitDisk

func InitDisk() (d Disk, err error)

type Os

type Os struct {
	GOOS         string `json:"goos"`
	NumCPU       int    `json:"numCpu"`
	Compiler     string `json:"compiler"`
	GoVersion    string `json:"goVersion"`
	NumGoroutine int    `json:"numGoroutine"`
}

func InitOS

func InitOS() (o Os)

type Rrm

type Rrm struct {
	UsedMB      int `json:"usedMb"`
	TotalMB     int `json:"totalMb"`
	UsedPercent int `json:"usedPercent"`
}

func InitRAM

func InitRAM() (r Rrm, err error)

type Server

type Server struct {
	Os   Os   `json:"os"`
	Cpu  Cpu  `json:"cpu"`
	Rrm  Rrm  `json:"ram"`
	Disk Disk `json:"disk"`
}

Jump to

Keyboard shortcuts

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