detkit.Memory.info#
- static Memory.info()#
Inquiry memory information.
- Returns:
- mem_info
A dictionary containing the following keys:
'total'
: total memory in bytes'used'
: used memory.'available'
: available memory.'allocatable'
: allocatable memory in bytes
Notes
Allocatable memory is obtained by the difference of total and used memory. Used memory is obtaiend as the summ of all RSS for all processes. This is a similar apporach that
top
andhtop
report.Examples
>>> from detkit import Memory, human_readable_mem >>> mem_info = Memory.info() >>> # total memory >>> print(human_readable_mem(mem_info['total'])) 15.6 (GB) >>> # used memory >>> print(human_readable_mem(mem_info['used'])) 4.28 (GB) >>> # allocatable memory >>> print(human_readable_mem(mem_info['allocatable'])) 9.24 (GB)