main.go 851 B

123456789101112131415161718192021
  1. package main
  2. import (
  3. "cicv-data-closedloop/common/util"
  4. "fmt"
  5. )
  6. //type DeviceMonitor struct {
  7. // Id int `db:"id" json:"id"` // 自增id
  8. // TotalCpuUsage string `db:"total_cpu_usage" json:"totalCpuUsage"` // cpu总占用
  9. // TotalMemoryUsage string `db:"total_memory_usage" json:"totalMemoryUsage"` // 内存总占用
  10. // Top10Process string `db:"top10_process" json:"top10Process"` // cpu占用前十的进程信息
  11. // DeviceNumber string `db:"device_number" json:"deviceNumber"` // cpu占用前十的进程信息
  12. // SocIp string `db:"soc_ip" json:"socIp"` // cpu占用前十的进程信息
  13. //}
  14. // 保存资源占用情况
  15. func main() {
  16. fmt.Println("cpu:", util.GetCpuPercent())
  17. fmt.Println("memory:", util.GetMemoryPercent())
  18. }