Documentation ¶
Index ¶
- Constants
- Variables
- func CPUAverage() float64
- func CPUAverageCallback(callback func(i float64))
- func CPUPercent() float64
- func CPUPercentCallback(callback func(i float64))
- func GetGlobalHealthManager() *healthinfo.Manager
- func InitHealthManager()
- func MemoryPercent() float64
- func MemoryPercentCallback(callback func(i float64))
- func SetMonitorIntervalFloat(i float64)
- func ShowMonitorInterval()
- func SystemHealthStats() (*health.HealthInfo, error)
Constants ¶
const LASTCPUPERCENT_KEY = "LastCPUPercent"
Variables ¶
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 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.