hids

package
v1.3.5-alpha0802 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const LASTCPUPERCENT_KEY = "LastCPUPercent"

Variables

View Source
var Exports = map[string]interface{}{

	"Init":                InitHealthManager,
	"SetMonitorInterval":  SetMonitorIntervalFloat,
	"ShowMonitorInterval": ShowMonitorInterval,

	"CPUPercent":            CPUPercent,
	"MemoryPercent":         MemoryPercent,
	"CPUAverage":            CPUAverage,
	"CPUPercentCallback":    CPUPercentCallback,
	"CPUAverageCallback":    CPUAverageCallback,
	"MemoryPercentCallback": MemoryPercentCallback,
}

Functions

func CPUAverage

func CPUAverage() float64

CPUAverage 获取当前系统的 CPU 使用率平均值 Example: ``` printf("%f%%\n", hids.CPUAverage()) ```

func CPUAverageCallback

func CPUAverageCallback(callback func(i float64))

CPUPercentCallback 当 CPU 使用率平均值发生变化时,调用 callback 函数 Example: ``` hids.Init() hids.CPUAverageCallback(func(i) { if (i > 50) { println("cpu average precent is over 50%") } // 当 CPU 使用率平均值超过50%时输出信息 }) ```

func CPUPercent

func CPUPercent() float64

CPUPercent 获取当前系统的 CPU 使用率 Example: ``` printf("%f%%\n", hids.CPUPercent()) ```

func CPUPercentCallback

func CPUPercentCallback(callback func(i float64))

CPUPercentCallback 当 CPU 使用率发生变化时,调用 callback 函数 Example: ``` hids.Init() hids.CPUPercentCallback(func(i) { if (i > 50) { println("cpu precent is over 50%") } // 当 CPU 使用率超过50%时输出信息 }) ```

func GetGlobalHealthManager

func GetGlobalHealthManager() *healthinfo.Manager

func InitHealthManager

func InitHealthManager()

Init 初始化全局健康管理器 Example: ``` hids.Init() ```

func MemoryPercent

func MemoryPercent() float64

MemoryPercent 获取当前系统的内存使用率 Example: ``` printf("%f%%\n", hids.MemoryPercent()) ```

func MemoryPercentCallback

func MemoryPercentCallback(callback func(i float64))

MemoryPercentCallback 当内存使用率发生变化时,调用 callback Example: ``` hids.Init() hids.MemoryPercentCallback(func(i) { if (i > 50) { println("memory precent is over 50%") } // 当内存使用率超过50%时输出信息 }) ```

func SetMonitorIntervalFloat

func SetMonitorIntervalFloat(i float64)

SetMonitorInterval 设置全局健康管理器的监控间隔(单位:秒),如果在全局健康管理器运行时调用,会重置全局健康管理器 Example: ``` hids.SetMonitorInterval(1) ```

func ShowMonitorInterval

func ShowMonitorInterval()

ShowMonitorInterval 在标准输出中输出全局健康管理器的监控间隔(单位:秒) Example: ``` hids.ShowMonitorInterval() ```

func SystemHealthStats

func SystemHealthStats() (*health.HealthInfo, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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