system-linux-proc-0.1.1: A library for accessing the /proc filesystem in Linux

Safe HaskellSafe
LanguageHaskell2010

System.Linux.Proc.MemInfo

Synopsis

Documentation

data MemInfo Source #

A struct to contain information parsed from the `/proc/meminfo` file (Linux only AFAIK). Fields that are listed as being in kilobytes in the proc filesystem are converted to bytes. Not all versions of the Linux kernel make all the fields in this struct available in which case they will be assigned a value of zero.

Constructors

MemInfo 

Fields

Instances
Eq MemInfo Source # 
Instance details

Defined in System.Linux.Proc.MemInfo

Methods

(==) :: MemInfo -> MemInfo -> Bool #

(/=) :: MemInfo -> MemInfo -> Bool #

Show MemInfo Source # 
Instance details

Defined in System.Linux.Proc.MemInfo

readProcMemInfo :: IO (Either ProcError MemInfo) Source #

Read the `/proc/meminfo` file (Linux only AFAIK) and return a MemInfo structure. Although this is in IO all exceptions and errors should be caught and returned as a ProcError.

readProcMemInfoKey :: ByteString -> IO (Either ProcError Word64) Source #

Read the value for the given key from `/proc/meminfo`. Although this is in IO all exceptions and errors should be caught and returned as a ProcError.

readProcMemUsage :: IO (Either ProcError Double) Source #

Read `/proc/meminfo` file and return a value calculated from:

MemAvailable / MemTotal

Although this is in IO all exceptions and errors should be caught and returned as a ProcError.

renderSizeBytes :: Word64 -> Text Source #

Render a Word64 as an easy to read size with a bytes, kB, MB, GB TB or PB suffix.