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