feat(api): add system resource monitoring functionality
- implement getSystemInfo to gather CPU and memory usage - add platform-specific implementations for memory and CPU usage - enhance OpenAPI documentation to include system resource metrics
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package api
|
||||
|
||||
type systemInfo struct {
|
||||
CPUUsage float64 `json:"cpu_usage"` // percent 0-100
|
||||
MemTotal uint64 `json:"mem_total"` // bytes
|
||||
MemUsed uint64 `json:"mem_used"` // bytes
|
||||
}
|
||||
|
||||
func getSystemInfo() systemInfo {
|
||||
memTotal, memUsed := getMemoryInfo()
|
||||
return systemInfo{
|
||||
CPUUsage: getCPUUsage(),
|
||||
MemTotal: memTotal,
|
||||
MemUsed: memUsed,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user