utils

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: Apache-2.0 Imports: 18 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 ExternalIP

func ExternalIP() (net.IP, error)

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 LoadFunc

func LoadFunc(skip int) string

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 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"`
}

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(AgentId int) (*Worker, error)

func (*Worker) GetId

func (w *Worker) GetId() int64

Jump to

Keyboard shortcuts

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