mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2026-04-22 23:57:20 +08:00
0b80fa53cf
- 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
17 lines
354 B
Go
17 lines
354 B
Go
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,
|
|
}
|
|
}
|