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
dcd0edca
Commit
dcd0edca
authored
Aug 27, 2001
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Got cache_detail and cache_extreme_detail working again and added links
from the debugging information screen.
parent
dfc5d6d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
57 deletions
+57
-57
lib/python/App/CacheManager.py
lib/python/App/CacheManager.py
+53
-56
lib/python/App/dtml/debug.dtml
lib/python/App/dtml/debug.dtml
+4
-1
No files found.
lib/python/App/CacheManager.py
View file @
dcd0edca
...
...
@@ -85,10 +85,10 @@
__doc__
=
'''Cache management support
$Id: CacheManager.py,v 1.2
0 2001/01/11 22:07:02 chrism
Exp $'''
__version__
=
'$Revision: 1.2
0
$'
[
11
:
-
2
]
$Id: CacheManager.py,v 1.2
1 2001/08/27 19:25:19 shane
Exp $'''
__version__
=
'$Revision: 1.2
1
$'
[
11
:
-
2
]
import
Globals
,
time
,
sys
import
Globals
,
time
,
sys
,
string
class
CacheManager
:
"""Cache management mix-in
...
...
@@ -252,62 +252,59 @@ class CacheManager:
db
.
setVersionCacheSize
(
self
.
_vcache_size
)
db
.
setVersionCacheDeactivateAfter
(
self
.
_vcache_age
)
def
cache_detail
(
self
):
try
:
db
=
self
.
_p_jar
.
db
()
except
:
# BoboPOS2
detail
=
{}
for
oid
,
ob
in
Globals
.
Bobobase
.
_jar
.
cache
.
items
():
if
hasattr
(
ob
,
'__class__'
):
ob
=
ob
.
__class__
decor
=
''
else
:
decor
=
' class'
c
=
"%s.%s%s"
%
(
ob
.
__module__
or
''
,
ob
.
__name__
,
decor
)
if
detail
.
has_key
(
c
):
detail
[
c
]
=
detail
[
c
]
+
1
else
:
detail
[
c
]
=
1
detail
=
detail
.
items
()
def
cache_detail
(
self
,
REQUEST
=
None
):
"""
Returns the name of the classes of the objects in the cache
and the number of objects in the cache for each class.
"""
db
=
self
.
_p_jar
.
db
()
detail
=
db
.
cacheDetail
()
if
REQUEST
is
not
None
:
# format as text
REQUEST
.
RESPONSE
.
setHeader
(
'Content-Type'
,
'text/plain'
)
return
string
.
join
(
map
(
lambda
(
name
,
count
):
'%6d %s'
%
(
count
,
name
),
detail
),
'
\
n
'
)
else
:
# ZODB 3
detail
=
db
.
cacheDetail
()
detail
=
map
(
lambda
d
:
((
"%s.%s"
%
(
d
[
0
].
__module__
,
d
[
0
].
__name__
)),
d
[
1
]),
detail
.
items
())
detail
.
sort
()
return
detail
def
cache_extreme_detail
(
self
):
try
:
db
=
self
.
_p_jar
.
db
()
except
:
# BoboPOS2
detail
=
[]
rc
=
sys
.
getrefcount
db
=
Globals
.
Bobobase
.
_jar
.
db
for
oid
,
ob
in
Globals
.
Bobobase
.
_jar
.
cache
.
items
():
id
=
oid
if
hasattr
(
ob
,
'__class__'
):
if
hasattr
(
ob
,
'__dict__'
):
d
=
ob
.
__dict__
if
d
.
has_key
(
'id'
):
id
=
"%s (%s)"
%
(
oid
,
d
[
'id'
])
elif
d
.
has_key
(
'__name__'
):
id
=
"%s (%s)"
%
(
oid
,
d
[
'__name__'
])
ob
=
ob
.
__class__
decor
=
''
else
:
decor
=
' class'
detail
.
append
({
'oid'
:
id
,
'klass'
:
"%s.%s%s"
%
(
ob
.
__module__
,
ob
.
__name__
,
decor
),
'rc'
:
rc
(
ob
)
-
4
,
'references'
:
db
.
objectReferencesIn
(
oid
),
})
# raw
return
detail
def
cache_extreme_detail
(
self
,
REQUEST
=
None
):
"""
Returns information about each object in the cache.
"""
db
=
self
.
_p_jar
.
db
()
detail
=
db
.
cacheExtremeDetail
()
if
REQUEST
is
not
None
:
# sort the list.
lst
=
map
(
lambda
dict
:
((
dict
[
'conn_no'
],
dict
[
'oid'
]),
dict
),
detail
)
lst
.
sort
()
# format as text.
res
=
[
'# Table shows connection number, oid, refcount, state, '
'and class.'
,
'# States: L = loaded, G = ghost, C = changed'
]
for
sortkey
,
dict
in
lst
:
id
=
dict
.
get
(
'id'
,
None
)
if
id
:
idinfo
=
' (%s)'
%
id
else
:
idinfo
=
''
s
=
dict
[
'state'
]
if
s
==
0
:
state
=
'L'
# loaded
elif
s
==
1
:
state
=
'C'
# changed
else
:
state
=
'G'
# ghost
res
.
append
(
'%d %-34s %6d %s %s%s'
%
(
dict
[
'conn_no'
],
`dict['oid']`
,
dict
[
'rc'
],
state
,
dict
[
'klass'
],
idinfo
))
REQUEST
.
RESPONSE
.
setHeader
(
'Content-Type'
,
'text/plain'
)
return
string
.
join
(
res
,
'
\
n
'
)
else
:
#
ZODB 3
return
d
b
.
cacheExtremeDetail
()
#
raw
return
d
etail
Globals
.
default__class_init__
(
CacheManager
)
lib/python/App/dtml/debug.dtml
View file @
dcd0edca
...
...
@@ -5,7 +5,7 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"<dtml-var BASEPATH1>/manage_page_style.css"
>
<dtml-if
debug_auto_reload
>
<meta
HTTP-EQUIV=
"Refresh"
CONTENT=
"&dtml-debug_auto_reload;;
URL=&dtml-URL;?debug_auto_reload=&dtml-debug_auto_reload;"
>
CONTENT=
"&dtml-debug_auto_reload;;URL=&dtml-URL;?debug_auto_reload=&dtml-debug_auto_reload;"
>
</dtml-if>
<style
type=
"text/css"
>
...
...
@@ -83,6 +83,9 @@ Delta
</dtml-in>
</table>
<p><a
href=
"../Database/cache_detail"
>
Cache detail
</a>
|
<a
href=
"../Database/cache_extreme_detail"
>
Cache extreme detail
</a>
</p>
<p><a
href=
"<dtml-var URL>?update_snapshot=1"
>
Update Snapshot
</a>
|
<dtml-if
debug_auto_reload
>
<a
href=
"<dtml-var URL>"
>
Stop auto refresh
</a>
...
...
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