| package common |
|
|
| import "sync/atomic" |
|
|
| |
| type PerformanceMonitorConfig struct { |
| Enabled bool |
| CPUThreshold int |
| MemoryThreshold int |
| DiskThreshold int |
| } |
|
|
| var performanceMonitorConfig atomic.Value |
|
|
| func init() { |
| |
| performanceMonitorConfig.Store(PerformanceMonitorConfig{ |
| Enabled: true, |
| CPUThreshold: 90, |
| MemoryThreshold: 90, |
| DiskThreshold: 90, |
| }) |
| } |
|
|
| |
| func GetPerformanceMonitorConfig() PerformanceMonitorConfig { |
| return performanceMonitorConfig.Load().(PerformanceMonitorConfig) |
| } |
|
|
| |
| func SetPerformanceMonitorConfig(config PerformanceMonitorConfig) { |
| performanceMonitorConfig.Store(config) |
| } |
|
|