kubernetes/vendor/bitbucket.org/bertimus9/systemstat/systemstat_ex.go
liz b7bdd7ba48
Update systemstat9 to allow compilation on OSX
The latest version of system statadds stubbed out methods for non-Linux OSes:
https://bitbucket.org/bertimus9/systemstat/pull-requests/2
2017-12-04 14:59:36 -05:00

50 lines
1.0 KiB
Go

// Copyright (c) 2013 Phillip Bond
// Licensed under the MIT License
// see file LICENSE
// +build !linux
package systemstat
import (
"syscall"
"time"
)
func getUptime(procfile string) (uptime UptimeSample) {
notImplemented("getUptime")
uptime.Time = time.Now()
return
}
func getLoadAvgSample(procfile string) (samp LoadAvgSample) {
notImplemented("getLoadAvgSample")
samp.Time = time.Now()
return
}
func getMemSample(procfile string) (samp MemSample) {
notImplemented("getMemSample")
samp.Time = time.Now()
return
}
func getProcCPUSample() (s ProcCPUSample) {
var processInfo syscall.Rusage
syscall.Getrusage(syscall.RUSAGE_SELF, &processInfo)
s.Time = time.Now()
s.ProcMemUsedK = int64(processInfo.Maxrss)
s.User = float64(processInfo.Utime.Usec)/1000000 + float64(processInfo.Utime.Sec)
s.System = float64(processInfo.Stime.Usec)/1000000 + float64(processInfo.Stime.Sec)
s.Total = s.User + s.System
return
}
func getCPUSample(procfile string) (samp CPUSample) {
notImplemented("getCPUSample")
samp.Time = time.Now()
return
}