system-linux-proc-0.1.1.1: A library for accessing the /proc filesystem in Linux
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Linux.Proc.MemInfo

Synopsis

Documentation

data MemInfo Source #

A struct to contain information parsed from the `procmeminfo` 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

Instances details
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 `procmeminfo` 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 `procmeminfo`. Although this is in IO all exceptions and errors should be caught and returned as a ProcError.

readProcMemUsage :: IO (Either ProcError Double) Source #

Read `procmeminfo` 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.