Esempio n. 1
0
func (self *Mem) Get() (err error) {
	si := sysinfo.Get()

	self.Load = uint32(float32(si.FreeRam) / float32(si.TotalRam) * float32(100.0))
	self.Total = si.TotalRam * 1024
	self.Used = (si.TotalRam - si.FreeRam) * 1024
	self.PageTotal = si.TotalSwap
	self.PageUsed = si.TotalSwap - si.FreeSwap
	self.Cache = si.SharedRam

	return nil
}
Esempio n. 2
0
func GetUptime() (val time.Duration, err error) {
	si := sysinfo.Get()
	val = si.Uptime
	return
}