mem-info-0.3.0.0: Print the core memory usage of programs
Copyright(c) 2022 Tim Emiola
LicenseBSD3
MaintainerTim Emiola <adetokunbo@emio.la>
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.MemInfo.Proc

Description

This module provides types that model data from files in the Linux proc filesystem that track memory usage, combinators for parsing the files contents, and for grouping the results.

Synopsis

Combine process memory metrics

data MemUsage Source #

Represents the measured memory usage of a program

Constructors

MemUsage 

Fields

Instances

Instances details
Show MemUsage Source # 
Instance details

Defined in System.MemInfo.Proc

Eq MemUsage Source # 
Instance details

Defined in System.MemInfo.Proc

amass :: Ord a => Bool -> [(a, ProcUsage)] -> Map a MemUsage Source #

Combine ProcUsage, grouping them by the effective program name

Parse process memory metrics

data ProcUsage Source #

Represents the memory metrics for a single process

Constructors

ProcUsage 

Fields

Instances

Instances details
Show ProcUsage Source # 
Instance details

Defined in System.MemInfo.Proc

Eq ProcUsage Source # 
Instance details

Defined in System.MemInfo.Proc

parseFromSmap :: Text -> ProcUsage Source #

Parse ProcUsage from the contents of /proc/<pid>/smap

parseFromStatm :: KernelVersion -> Text -> Maybe ProcUsage Source #

Parse ProcUsage from the contents of /proc/<pid>/statm

Parse /proc/<pid>/exe

data ExeInfo Source #

Represents the information about a process obtained from /proc/<pid>/exe

Constructors

ExeInfo 

Fields

  • eiTarget :: !Text

    the path that the link /proc/<pid>/exe resolves to

  • eiOriginal :: !Text

    a sanitized form of eiTarget; it removes the (deleted) suffix

  • eiDeleted :: !Bool

    does eiTarget end with (deleted)?

Instances

Instances details
Generic ExeInfo Source # 
Instance details

Defined in System.MemInfo.Proc

Associated Types

type Rep ExeInfo :: Type -> Type #

Methods

from :: ExeInfo -> Rep ExeInfo x #

to :: Rep ExeInfo x -> ExeInfo #

Show ExeInfo Source # 
Instance details

Defined in System.MemInfo.Proc

Eq ExeInfo Source # 
Instance details

Defined in System.MemInfo.Proc

Methods

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

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

Validity ExeInfo Source # 
Instance details

Defined in System.MemInfo.Proc

type Rep ExeInfo Source # 
Instance details

Defined in System.MemInfo.Proc

type Rep ExeInfo = D1 ('MetaData "ExeInfo" "System.MemInfo.Proc" "mem-info-0.3.0.0-7EhepxXcovz8rKbAxS2unK" 'False) (C1 ('MetaCons "ExeInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "eiTarget") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "eiOriginal") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "eiDeleted") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))))

parseExeInfo :: Text -> ExeInfo Source #

Parses the target of /proc/<pid>/exe into a ExeInfo

Parse /proc/<pid>/status

parseStatusInfo :: Text -> Either BadStatus StatusInfo Source #

Parses the content of /proc/<pid>/status into a StatusInfo

data StatusInfo Source #

Represents the information about a process obtained from procpid/status

Constructors

StatusInfo 

Fields

Instances

Instances details
Generic StatusInfo Source # 
Instance details

Defined in System.MemInfo.Proc

Associated Types

type Rep StatusInfo :: Type -> Type #

Show StatusInfo Source # 
Instance details

Defined in System.MemInfo.Proc

Eq StatusInfo Source # 
Instance details

Defined in System.MemInfo.Proc

Validity StatusInfo Source # 
Instance details

Defined in System.MemInfo.Proc

type Rep StatusInfo Source # 
Instance details

Defined in System.MemInfo.Proc

type Rep StatusInfo = D1 ('MetaData "StatusInfo" "System.MemInfo.Proc" "mem-info-0.3.0.0-7EhepxXcovz8rKbAxS2unK" 'False) (C1 ('MetaCons "StatusInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "siName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "siParent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ProcessID)))

data BadStatus Source #

Indicates why parseStatusInfo failed

Constructors

NoCmd 
NoParent 

Instances

Instances details
Show BadStatus Source # 
Instance details

Defined in System.MemInfo.Proc

Eq BadStatus Source # 
Instance details

Defined in System.MemInfo.Proc