containerd/supervisor/machine.go
Amit Krishnan 62e1370f91 containerd build clean on Solaris (#203)
* containerd build clean on Solaris

Signed-off-by: Amit Krishnan <krish.amit@gmail.com>

* Vendor golang.org/x/sys

Signed-off-by: Amit Krishnan <krish.amit@gmail.com>
2016-05-19 10:12:50 -07:00

25 lines
437 B
Go

// +build !solaris
package supervisor
import "github.com/cloudfoundry/gosigar"
type Machine struct {
Cpus int
Memory int64
}
func CollectMachineInformation() (Machine, error) {
m := Machine{}
cpu := sigar.CpuList{}
if err := cpu.Get(); err != nil {
return m, err
}
m.Cpus = len(cpu.List)
mem := sigar.Mem{}
if err := mem.Get(); err != nil {
return m, err
}
m.Memory = int64(mem.Total / 1024 / 1024)
return m, nil
}