提交 138a1ea5 编写于 作者: W WAKAYAMA shirou

fix some errors on freebsd.

上级 7396461d
......@@ -6,8 +6,8 @@ import (
"fmt"
)
func (c CPU) Cpu_times() ([]CPU_Times, error) {
ret := make([]CPU_Times, 0)
func Cpu_times() ([]CPU_TimesStat, error) {
ret := make([]CPU_TimesStat, 0)
fmt.Println("FreeBSD")
return ret, nil
......
......@@ -3,7 +3,7 @@
package gopsutil
import (
"exec"
"os/exec"
"strconv"
"strings"
)
......@@ -17,23 +17,23 @@ func LoadAvg() (LoadAvgStat, error) {
v = strings.Replace(string(v), " }", "", 1)
values := strings.Fields(string(v))
load1, err := strconv.ParseFloat(values[0], 32)
load1, err := strconv.ParseFloat(values[0], 64)
if err != nil {
return LoadAvgStat{}, err
}
load5, err := strconv.ParseFloat(values[1], 32)
load5, err := strconv.ParseFloat(values[1], 64)
if err != nil {
return LoadAvgStat{}, err
}
load15, err := strconv.ParseFloat(values[2], 32)
load15, err := strconv.ParseFloat(values[2], 64)
if err != nil {
return LoadAvgStat{}, err
}
ret := LoadAvgStat{
Load1: float32(load1),
Load5: float32(load5),
Load15: float32(load15),
Load1: float64(load1),
Load5: float64(load5),
Load15: float64(load15),
}
return ret, nil
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册