meminfo.go 701 B

1234567891011121314151617181920212223242526
  1. // Package meminfo provides utilites to retrieve memory statistics of
  2. // the host system.
  3. package meminfo
  4. // Read retrieves memory statistics of the host system and returns a
  5. // Memory type. It is only supported on Linux and Windows, and returns an
  6. // error on other platforms.
  7. func Read() (*Memory, error) {
  8. return readMemInfo()
  9. }
  10. // Memory contains memory statistics of the host system.
  11. type Memory struct {
  12. // Total usable RAM (i.e. physical RAM minus a few reserved bits and the
  13. // kernel binary code).
  14. MemTotal int64
  15. // Amount of free memory.
  16. MemFree int64
  17. // Total amount of swap space available.
  18. SwapTotal int64
  19. // Amount of swap space that is currently unused.
  20. SwapFree int64
  21. }