diff options
author | Eduardo Silva <edsiper@tuto.(none)> | 2007-01-02 23:24:44 (GMT) |
---|---|---|
committer | Eduardo Silva <edsiper@tuto.(none)> | 2007-01-02 23:24:44 (GMT) |
commit | e28a1b27ee6cb527b7ede0a244cf5990f7e50568 (patch) | |
tree | 62cc6988c4c226db602dbf345617d170669b2e31 /shell/console/interface/memphis/plugin.py | |
parent | 80cd6af44c296ee8bc9ba30ad54f335fd4b7a4fe (diff) |
[dev-console] - New internal structure, and new XO interface
Diffstat (limited to 'shell/console/interface/memphis/plugin.py')
-rw-r--r-- | shell/console/interface/memphis/plugin.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/shell/console/interface/memphis/plugin.py b/shell/console/interface/memphis/plugin.py new file mode 100644 index 0000000..5ee8eb7 --- /dev/null +++ b/shell/console/interface/memphis/plugin.py @@ -0,0 +1,48 @@ +############################################### +# Memphis Plugin Support +############################################### + +import sys, os +from procmem import proc, proc_smaps, analysis + +class Plugin: + + # 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) + + def proc_analysis(self, pid): + return analysis.Analysis(pid) + |