From 138a1ea5a8624b0e43f2bfabc19cf7d52530ee01 Mon Sep 17 00:00:00 2001 From: WAKAYAMA shirou Date: Tue, 22 Apr 2014 10:12:01 +0900 Subject: [PATCH] fix some errors on freebsd. --- cpu_freebsd.go | 4 ++-- load_freebsd.go | 14 +++++++------- mem_linux.go => mem_unix.go | 0 3 files changed, 9 insertions(+), 9 deletions(-) rename mem_linux.go => mem_unix.go (100%) diff --git a/cpu_freebsd.go b/cpu_freebsd.go index 79d83f2..8318b43 100644 --- a/cpu_freebsd.go +++ b/cpu_freebsd.go @@ -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 diff --git a/load_freebsd.go b/load_freebsd.go index f7a925f..4217bdf 100644 --- a/load_freebsd.go +++ b/load_freebsd.go @@ -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 diff --git a/mem_linux.go b/mem_unix.go similarity index 100% rename from mem_linux.go rename to mem_unix.go