This commit is contained in:
WAKAYAMA shirou 2014-04-22 12:43:31 +09:00
parent 6d291867b8
commit 7d1ba2a9df
4 changed files with 6 additions and 8 deletions

View File

@ -7,7 +7,7 @@ import (
"strings"
)
func do_sysctrl(mib string) ([]string, error){
func do_sysctrl(mib string) ([]string, error) {
out, err := exec.Command("/sbin/sysctl", "-n", mib).Output()
if err != nil {
return []string{}, err

View File

@ -4,8 +4,8 @@ package gopsutil
import (
"os"
"strings"
"strconv"
"strings"
)
func HostInfo() (HostInfoStat, error) {
@ -20,9 +20,8 @@ func HostInfo() (HostInfoStat, error) {
return ret, nil
}
func Boot_time() (int64, error){
values,err := do_sysctrl("kern.boottime")
func Boot_time() (int64, error) {
values, err := do_sysctrl("kern.boottime")
if err != nil {
return 0, err
}

View File

@ -19,8 +19,7 @@ func HostInfo() (HostInfoStat, error) {
return ret, nil
}
func Boot_time() (int64, error){
func Boot_time() (int64, error) {
sysinfo := &syscall.Sysinfo_t{}
if err := syscall.Sysinfo(sysinfo); err != nil {
return 0, err

View File

@ -7,7 +7,7 @@ import (
)
func LoadAvg() (LoadAvgStat, error) {
values,err := do_sysctrl("vm.loadavg")
values, err := do_sysctrl("vm.loadavg")
if err != nil {
return LoadAvgStat{}, err
}