System.Posix.LoadAvg
Description
There are two basic ways you can get load average on a modern Linux system.
First is getloadavg (3)
system call. The second is /proc/loadavg
file.
This module provides means of getting the information from both sources.
/proc/loadavg
provides some additional information but we ignore that.
Documentation
Constructors
LoadAvg | |
parseLoadAvg :: String -> LoadAvgSource
Tries to parse the output of /proc/loadavg
. If anything goes wrong an arbitrary exception will be raised.
getLoadAvg :: IO LoadAvgSource
Discards error checking from getLoadAvgSafe. Will raise IO exception on error.
getLoadAvgSafe :: IO (Maybe LoadAvg)Source
Calls getloadavg (3)
to get system load average.
Provides error checking, and the result may be Nothing in case of error.
If there is not enough data the samples will be copied from more recent samples.
getLoadAvgProc :: IO LoadAvgSource
Tries to read /proc/loadavg
and parse it's output with parseLoadAvg
. Either may fail with IO exception.