Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
09a53f7b
Commit
09a53f7b
authored
Jun 09, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added refcount delta reporting to manage_debug in the Control_Panel.
parent
17e9f372
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
14 deletions
+111
-14
lib/python/App/ApplicationManager.py
lib/python/App/ApplicationManager.py
+50
-10
lib/python/App/debug.dtml
lib/python/App/debug.dtml
+61
-4
No files found.
lib/python/App/ApplicationManager.py
View file @
09a53f7b
...
...
@@ -83,7 +83,7 @@
#
##############################################################################
__doc__
=
"""System management components"""
__version__
=
'$Revision: 1.
49
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
50
$'
[
11
:
-
2
]
import
sys
,
os
,
time
,
string
,
Globals
,
Acquisition
,
os
...
...
@@ -91,6 +91,7 @@ from Globals import HTMLFile
from
OFS.ObjectManager
import
ObjectManager
from
OFS.Folder
import
Folder
from
CacheManager
import
CacheManager
from
DateTime.DateTime
import
DateTime
from
OFS
import
SimpleItem
from
App.Dialogs
import
MessageDialog
from
Product
import
ProductFolder
...
...
@@ -126,7 +127,7 @@ class VersionManager(Fake, SimpleItem.Item, Acquisition.Implicit):
manage_options
=
(
{
'label'
:
'Version'
,
'action'
:
'manage_main'
},
)
...
...
@@ -240,24 +241,63 @@ class ApplicationManager(Folder,CacheManager):
manage_debug
=
HTMLFile
(
'debug'
,
globals
())
def
get_refcounts
(
self
,
n
=
100
,
t
=
(
type
(
Fake
),
type
(
Acquisition
.
Implicit
))):
# get class refcount info
# refcount snapshot info
_v_rcs
=
None
_v_rst
=
None
def
refcount
(
self
,
n
=
None
,
t
=
(
type
(
Fake
),
type
(
Acquisition
.
Implicit
))):
# return class reference 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
=
[]
append
=
pairs
.
append
for
ob
,
v
in
dict
.
items
():
if
hasattr
(
ob
,
'__module__'
):
name
=
'%s.%s'
%
(
ob
.
__module__
,
ob
.
__name__
)
else
:
name
=
'%s'
%
ob
.
__name__
append
((
v
,
name
))
pairs
.
sort
()
pairs
.
reverse
()
pairs
=
pairs
[:
n
]
if
n
is
not
None
:
pairs
=
pairs
[:
n
]
return
pairs
def
refdict
(
self
):
rc
=
self
.
refcount
()
dict
=
{}
for
v
,
n
in
rc
:
dict
[
n
]
=
v
return
dict
def
rcsnapshot
(
self
):
self
.
_v_rcs
=
self
.
refdict
()
self
.
_v_rst
=
DateTime
()
def
rcdate
(
self
):
return
self
.
_v_rst
def
rcdeltas
(
self
):
if
self
.
_v_rcs
is
None
:
self
.
rcsnapshot
()
nc
=
self
.
refdict
()
rc
=
self
.
_v_rcs
rd
=
[]
for
n
,
c
in
nc
.
items
():
prev
=
rc
[
n
]
if
c
>
prev
:
rd
.
append
(
(
c
-
prev
,
(
c
,
prev
,
n
))
)
rd
.
sort
()
rd
.
reverse
()
return
map
(
lambda
n
:
{
'name'
:
n
[
1
][
2
],
'delta'
:
n
[
0
],
'pc'
:
n
[
1
][
1
],
'rc'
:
n
[
1
][
0
]},
rd
)
if
hasattr
(
sys
,
'ZMANAGED'
):
...
...
lib/python/App/debug.dtml
View file @
09a53f7b
<html>
<head>
<title>
Debug Information
</title>
<style
type=
"text/css"
>
<!
--
.header
{
font-weight
:
bold
;
font-size
:
10pt
;
}
.cell
{
font-size
:
10pt
;
}
--
>
</style>
</head>
<body
bgcolor=
"#FFFFFF"
link=
"#000099"
vlink=
"#555555"
>
<!--#var manage_tabs-->
<!--#if update_snapshot-->
<!--#call rcsnapshot-->
<!--#endif-->
<h3>
Debug Information
</h3>
<form>
<p>
...
...
@@ -14,14 +31,54 @@
<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
<li>
Top
Refcounts:
<select
name=
"foo"
>
<!--#in
"refcount(100)"
-->
<option>
<!--#var
sequence-item-->
:
<!--#var sequence-key-->
</option>
<!--#/in
-->
</select>
-->
</select><br><br>
<table
border=
"1"
>
<!--#in rcdeltas mapping-->
<!--#if sequence-start-->
<tr>
<th
class=
"header"
align=
"left"
valign=
"top"
>
Class
</th>
<th
class=
"header"
align=
"left"
valign=
"top"
>
<!--#var rcdate fmt="fCommon"-->
</th>
<th
class=
"header"
align=
"left"
valign=
"top"
>
<!--#var ZopeTime fmt="fCommon"-->
</th>
<th
class=
"header"
align=
"left"
valign=
"top"
>
Delta
</th>
</tr>
<!--#/if-->
<tr>
<td
class=
"cell"
align=
"left"
valign=
"top"
>
<!--#var name-->
</td>
<td
class=
"cell"
align=
"left"
valign=
"top"
>
<!--#var pc-->
</td>
<td
class=
"cell"
align=
"left"
valign=
"top"
>
<!--#var rc-->
</td>
<td
class=
"cell"
align=
"left"
valign=
"top"
>
+
<!--#var delta-->
</td>
</tr>
<!--#/in-->
</table>
<a
href=
"<!--#var URL-->?update_snapshot=1"
>
Update Snapshot
</a>
|
<a
href=
"<!--#var URL-->"
>
Refresh
</a>
</ul>
</p>
</form>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment