(values map[string]float64)
| 19 | const BYTES_PER_GB = 1073741824 |
| 20 | |
| 21 | func 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 | |
| 38 | func getMemData(values map[string]float64) { |
| 39 | memData, err := mem.VirtualMemory() |
no outgoing calls
no test coverage detected