MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / getCpuData

Function getCpuData

pkg/wshrpc/wshremote/sysinfo.go:21–36  ·  view source on GitHub ↗
(values map[string]float64)

Source from the content-addressed store, hash-verified

19const BYTES_PER_GB = 1073741824
20
21func getCpuData(values map[string]float64) {
22 percentArr, err := cpu.Percent(0, false)
23 if err != nil {
24 return
25 }
26 if len(percentArr) > 0 {
27 values[wshrpc.TimeSeries_Cpu] = percentArr[0]
28 }
29 percentArr, err = cpu.Percent(0, true)
30 if err != nil {
31 return
32 }
33 for idx, percent := range percentArr {
34 values[wshrpc.TimeSeries_Cpu+":"+strconv.Itoa(idx)] = percent
35 }
36}
37
38func getMemData(values map[string]float64) {
39 memData, err := mem.VirtualMemory()

Callers 1

generateSingleServerDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected