common

package
v0.0.0-...-539d32a Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLines = errors.New("not correct line format")
)
View Source
var (
	ErrUnSupportFormat = errors.New("unsupported time format")
)

Functions

func CompressToGzipFile

func CompressToGzipFile(srcPath, dstPath string) error

func CpuLoad1Usage

func CpuLoad1Usage() float64

func DiskUsagePercent

func DiskUsagePercent() float64

func EnsureDirExist

func EnsureDirExist(path string) error

func MemoryUsagePercent

func MemoryUsagePercent() float64

func ParseMemLimit

func ParseMemLimit(lines []string) (uint64, error)

func ParseMemUsage

func ParseMemUsage(lines []string) (uint64, error)

func ReadFileLines

func ReadFileLines(path string) ([]string, error)

Types

type Mem

type Mem struct {
	LimitUsage uint64
	Usage      uint64

	Stats MemStat
}

func CGroupMem

func CGroupMem() (Mem, error)

func (Mem) MemUsageNoCache

func (m Mem) MemUsageNoCache() float64

func (Mem) Percent

func (m Mem) Percent() float64

type MemStat

type MemStat map[string]uint64

func ParseMemStat

func ParseMemStat(lines []string) (MemStat, error)

type UTCTime

type UTCTime struct {
	time.Time
}

func NewNowUTCTime

func NewNowUTCTime() UTCTime

func NewUTCTime

func NewUTCTime(now time.Time) UTCTime

func (UTCTime) MarshalJSON

func (t UTCTime) MarshalJSON() ([]byte, error)

func (*UTCTime) UnmarshalJSON

func (t *UTCTime) UnmarshalJSON(data []byte) (err error)

Jump to

Keyboard shortcuts

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