MCPcopy Index your code
hub / github.com/koding/kite / memoryStats

Function memoryStats

systeminfo/systeminfo_windows.go:43–65  ·  view source on GitHub ↗

memoryStatus retrieves information about the system's current usage of physical memory.

()

Source from the content-addressed store, hash-verified

41// memoryStatus retrieves information about the system's current usage of
42// physical memory.
43func memoryStats() (*memory, error) {
44 mstat := struct {
45 size uint32
46 _ uint32
47 totalPhys uint64
48 availPhys uint64
49 _ [5]uint64
50 }{}
51
52 // windows sets return value to 0 when function fails.
53 mstat.size = uint32(unsafe.Sizeof(mstat))
54 ret, _, err := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&mstat)))
55 if ret == 0 {
56 return nil, err
57 }
58
59 // memoryStats functions from other platforms return memory usage in bytes.
60 return &memory{
61 Usage: mstat.totalPhys - mstat.availPhys,
62 Total: mstat.totalPhys,
63 }, nil
64
65}

Callers

nothing calls this directly

Calls 1

CallMethod · 0.65

Tested by

no test coverage detected