stat

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TopQueneCap = 30
)

Variables

This section is empty.

Functions

func GetCurrentCPU

func GetCurrentCPU() float64

func GetCurrentKernelDisk

func GetCurrentKernelDisk() float64

func GetCurrentMainDisk

func GetCurrentMainDisk() uint64

func GetCurrentMem

func GetCurrentMem() float64

func GetTotalKernelDisk

func GetTotalKernelDisk() uint64

func GetTotalMainDisk

func GetTotalMainDisk() uint64

func LoadTop

func LoadTop(path string, fn func(map[string]any))

Types

type CircleQueue

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

CircleQueue 环形队列

func NewCircleQueue

func NewCircleQueue(size uint8) *CircleQueue

NewCircleQueue ...

func (*CircleQueue) Last

func (c *CircleQueue) Last() *PercentData

func (*CircleQueue) Push

func (c *CircleQueue) Push(v PercentData)

Push 入队, 当队列满时, 覆盖旧数据

func (*CircleQueue) Range

func (c *CircleQueue) Range() []PercentData

Range 取出队列中所有数据

type PercentData

type PercentData struct {
	Time orm.Time `json:"time"`
	Used float64  `json:"used"`

	Up   float64 `json:"up"`
	Down float64 `json:"down"`
}

PercentData 时间百分比

func GetCPUData

func GetCPUData() []PercentData

func GetMemData

func GetMemData() []PercentData

func GetNetData

func GetNetData() []PercentData

type UsageStat

type UsageStat struct {
	Name      string `json:"name"`       // 路径
	Unit      string `json:"unit"`       // 单位
	Size      string `json:"size"`       // 大小
	FreeSpace string `json:"free_space"` // 可用空间
	Used      string `json:"used"`       // 已使用
	Percent   string `json:"percent"`    // 比率
	Threshold string `json:"threshold"`  // 阈值
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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