DevConsole: New referenced memory usage field in Memphis (introduced in kernel 2.6.22)

This commit is contained in:
Eduardo Silva
2007-08-07 18:14:19 -04:00
parent a3efc1284f
commit 91f68897a6
7 changed files with 46 additions and 35 deletions
@@ -0,0 +1,6 @@
sugardir = $(pkgdatadir)/services/console/interface/memphis/plugins/dirty_size
sugar_PYTHON = \
README \
__init__.py \
info.py
@@ -0,0 +1,2 @@
This plugin give support to get the public and shared dirty memory usage
by process using the /proc/PID/smaps file.
@@ -0,0 +1,17 @@
import info
INTERNALS = {
# Basic information
'PLGNAME': "SMaps",
'TABNAME': None, # No tabbed plugin
'AUTHOR': "Eduardo Silva",
'DESC': "Get dirty size and reference memory usage",
# Plugin API
'Plg': None, # Plugin object
'top_data': [int, int], # Top data types needed by memphis core plugin
'top_cols': ["PDRSS (kb)", "Referenced (kb)"]
}
@@ -0,0 +1,19 @@
###########################################################
# Main function:
# -----------------
# self: self plugin object
# mself: memphis object / principal class
# pinfo: row with information about current tracing process
############################################################
def plg_on_top_data_refresh(self, ppinfo):
smaps = get_data(self, ppinfo['pid'])
# memphis need an array
return [smaps['private_dirty'], smaps['referenced']]
def get_data(pself, pid):
ProcAnalysis = pself.INTERNALS['Plg'].proc_analysis(pid)
return ProcAnalysis.SMaps()