05590bfb8c
--HG-- branch : dev
32 lines
666 B
Go
32 lines
666 B
Go
package worker
|
|
|
|
import (
|
|
"runtime"
|
|
"encoding/json"
|
|
)
|
|
|
|
type systemInfo struct {
|
|
GOOS, GOARCH, GOROOT, Version string
|
|
NumCPU, NumGoroutine int
|
|
NumCgoCall int64
|
|
}
|
|
|
|
func SysInfo(job *Job) ([]byte, error) {
|
|
return json.Marshal(&systemInfo{
|
|
GOOS: runtime.GOOS,
|
|
GOARCH: runtime.GOARCH,
|
|
GOROOT: runtime.GOROOT(),
|
|
Version: runtime.Version(),
|
|
NumCPU: runtime.NumCPU(),
|
|
NumGoroutine: runtime.NumGoroutine(),
|
|
NumCgoCall: runtime.NumCgoCall(),
|
|
})
|
|
}
|
|
|
|
var memState runtime.MemStats
|
|
|
|
func MemInfo(job *Job) ([]byte, error) {
|
|
runtime.ReadMemStats(&memState)
|
|
return json.Marshal(&memState)
|
|
}
|