Commit 17e9f372 authored by 's avatar

Added manage_debug page and simple refcount report.

parent 978147e5
......@@ -83,7 +83,7 @@
#
##############################################################################
__doc__="""System management components"""
__version__='$Revision: 1.48 $'[11:-2]
__version__='$Revision: 1.49 $'[11:-2]
import sys,os,time,string,Globals, Acquisition, os
......@@ -96,6 +96,7 @@ from App.Dialogs import MessageDialog
from Product import ProductFolder
from version_txt import version_txt
class Fake:
def locked_in_version(self): return 0
......@@ -126,6 +127,10 @@ class VersionManager(Fake, SimpleItem.Item, Acquisition.Implicit):
{'label':'Version', 'action':'manage_main'},
)
class ApplicationManager(Folder,CacheManager):
"""System management"""
......@@ -232,6 +237,29 @@ class ApplicationManager(Folder,CacheManager):
if s >= 1048576.0: return '%.1fM' % (s/1048576.0)
return '%.1fK' % (s/1024.0)
manage_debug=HTMLFile('debug', globals())
def get_refcounts(self, n=100, t=(type(Fake), type(Acquisition.Implicit))):
# get class refcount info
dict={}
for m in sys.modules.values():
for sym in dir(m):
ob=getattr(m, sym)
if type(ob) in t:
dict[ob]=sys.getrefcount(ob)
pairs = map(lambda x: (x[1], '%s' % x[0].__name__), dict.items())
pairs.sort()
pairs.reverse()
pairs=pairs[:n]
return pairs
if hasattr(sys, 'ZMANAGED'):
manage_restartable=1
......
<html>
<head>
<title>Debug Information</title>
</head>
<body bgcolor="#FFFFFF" link="#000099" vlink="#555555">
<!--#var manage_tabs-->
<h3>Debug Information</h3>
<form>
<p>
<ul>
<li>Zope version: <!--#var version_txt-->
<li>Python version: <!--#var sys_version-->
<li>System Platform: <!--#var sys_platform-->
<li>Process ID: <!--#var process_id-->
<li>Running for: <!--#var process_time-->
<li>Refcounts: <select name="foo"><!--#in
get_refcounts--><option><!--#var
sequence-item-->: <!--#var sequence-key--></option><!--#/in
--></select>
</ul>
</p>
</form>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment