MCPcopy
hub / github.com/inbug-team/InScan / GetMemInfo

Function GetMemInfo

host_info/host_info.go:122–134  ·  view source on GitHub ↗

5.内存信息

()

Source from the content-addressed store, hash-verified

120
121// 5.内存信息
122func GetMemInfo() (float64, []map[string]interface{}) {
123 info, err := mem.VirtualMemory()
124 if err != nil {
125 fmt.Println(err)
126 return 0, nil
127 }
128 return decimal(fmt.Sprintf("%.1f", info.UsedPercent)), []map[string]interface{}{
129 {"key": "使用率[%]", "value": decimal(fmt.Sprintf("%.1f", info.UsedPercent))},
130 {"key": "总量[GB]", "value": int(info.Total / GB)},
131 {"key": "使用量[GB]", "value": int(info.Used / GB)},
132 {"key": "剩余量[GB]", "value": int(info.Free / GB)},
133 }
134}
135
136// 6.获取网卡信息
137func GetNetInfo() (result []net.IOCountersStat, err error) {

Callers

nothing calls this directly

Calls 1

decimalFunction · 0.85

Tested by

no test coverage detected