2006-11-16 13:09:07 +01:00
|
|
|
###############################################
|
|
|
|
# Memphis Plugin Support
|
|
|
|
###############################################
|
|
|
|
|
|
|
|
import sys, os, time
|
|
|
|
import gtk, gobject
|
|
|
|
|
|
|
|
from procmem import proc, proc_smaps, analysis
|
|
|
|
|
|
|
|
class Plugin:
|
|
|
|
|
2006-12-04 20:12:24 +01:00
|
|
|
# Plugin list
|
|
|
|
list = []
|
|
|
|
proc = proc.ProcInfo()
|
|
|
|
|
|
|
|
internal_plugin = "memphis_init"
|
|
|
|
plg_path = os.path.dirname(os.path.abspath(__file__)) + "/plugins"
|
|
|
|
|
|
|
|
# Frequency timer, managed by main program
|
|
|
|
freq_timer = 0
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
|
|
|
|
sys.path.insert(0, self.plg_path)
|
|
|
|
|
|
|
|
# Including memphis plugin
|
|
|
|
self.list.append(__import__(self.internal_plugin))
|
|
|
|
|
|
|
|
if os.path.isdir(self.plg_path):
|
|
|
|
# around dir entries
|
|
|
|
for plg in os.listdir(self.plg_path):
|
|
|
|
|
|
|
|
if plg == self.internal_plugin:
|
|
|
|
continue
|
|
|
|
|
|
|
|
if os.path.isdir(self.plg_path + "/" + plg):
|
|
|
|
p = __import__(plg)
|
|
|
|
self.list.append(__import__(plg))
|
|
|
|
|
|
|
|
# Parse /proc/PID/smaps information
|
|
|
|
def proc_get_smaps(self, pid):
|
|
|
|
return proc_smaps.ProcSmaps(pid)
|
|
|
|
|
|
|
|
# Parse /proc/PID/maps information
|
|
|
|
def proc_get_maps(self, pid):
|
|
|
|
return proc_smaps.ProcMaps(pid)
|
2006-11-16 13:09:07 +01:00
|
|
|
|
2006-12-04 20:12:24 +01:00
|
|
|
def proc_analysis(self, pid):
|
|
|
|
return analysis.Analysis(pid)
|
|
|
|
|