fix some errors on freebsd.

This commit is contained in:
WAKAYAMA shirou 2014-04-22 10:12:01 +09:00
parent 7396461d07
commit 138a1ea5a8
3 changed files with 9 additions and 9 deletions

View File

@ -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

View File

@ -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