Copyright | (c) 2022 Tim Emiola |
---|---|
License | BSD3 |
Maintainer | Tim Emiola <adetokunbo@emio.la> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module provides data types that
- define memory reports (cf
) andReportBud
- provide info about the system where the report will run (cf
,KernelVersion
andSwapFlaw
).RamFlaw
along with functions that use these types.
Synopsis
- data ReportBud = ReportBud {
- rbPids :: !(NonEmpty ProcessID)
- rbKernel :: !KernelVersion
- rbHasPss :: !Bool
- rbHasSwapPss :: !Bool
- rbHasSmaps :: !Bool
- rbRamFlaws :: Maybe RamFlaw
- rbSwapFlaws :: Maybe SwapFlaw
- mkReportBud :: NonEmpty ProcessID -> IO (Maybe ReportBud)
- data RamFlaw
- data SwapFlaw
- checkForFlaws :: ReportBud -> IO ReportBud
- fmtRamFlaws :: RamFlaw -> Text
- fmtSwapFlaws :: SwapFlaw -> Text
- type KernelVersion = (Natural, Natural, Natural)
- parseKernelVersion :: Text -> Maybe KernelVersion
- readKernelVersion :: IO (Maybe KernelVersion)
- fickleSharing :: KernelVersion -> Bool
define reports
Gathers the inputs needed to generate a memory usage report
ReportBud | |
|
mkReportBud :: NonEmpty ProcessID -> IO (Maybe ReportBud) Source #
Construct a ReportBud
from some ProcessIDs
Generates values for the other fields by inspecting the system
The result is Nothing
only when the KernelVersion
cannot be determined
indicate calculation flaws
Describes inaccuracies in the RAM calculation
NoSharedMem | no shared mem is reported |
SomeSharedMem | some shared mem not reported |
ExactForIsolatedMem | accurate only considering each process in isolation |
Instances
Show RamFlaw Source # | |
Eq RamFlaw Source # | |
Ord RamFlaw Source # | |
Describes inaccuracies in the swap measurement
NoSwap | not available |
ExactForIsolatedSwap | accurate only considering each process in isolation |
Instances
Show SwapFlaw Source # | |
Eq SwapFlaw Source # | |
Ord SwapFlaw Source # | |
Defined in System.MemInfo.SysInfo |
system kernel version
parseKernelVersion :: Text -> Maybe KernelVersion Source #
Parses Text
into a KernelVersion
readKernelVersion :: IO (Maybe KernelVersion) Source #
Determines the version of the Linux kernel on the current system.
fickleSharing :: KernelVersion -> Bool Source #
On linux kernels before smaps became available, there was no reliable way to determine how much of a processes memory was shared