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
This commit is contained in:
49
vendor/bitbucket.org/bertimus9/systemstat/systemstat_ex.go
generated
vendored
Normal file
49
vendor/bitbucket.org/bertimus9/systemstat/systemstat_ex.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// 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
|
||||
}
|
Reference in New Issue
Block a user