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
b8f178d3
Commit
b8f178d3
authored
Aug 01, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some dead code and protect access to the benchmark entry
parent
fd836247
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
16 deletions
+4
-16
src/Products/ZCatalog/plan.py
src/Products/ZCatalog/plan.py
+4
-16
No files found.
src/Products/ZCatalog/plan.py
View file @
b8f178d3
...
@@ -182,7 +182,8 @@ class CatalogPlan(object):
...
@@ -182,7 +182,8 @@ class CatalogPlan(object):
# remember index's hits, search time and calls
# remember index's hits, search time and calls
benchmark
=
self
.
benchmark
()
benchmark
=
self
.
benchmark
()
if
name
not
in
benchmark
:
if
name
not
in
benchmark
:
benchmark
[
name
]
=
Benchmark
(
num
=
length
,
duration
=
dt
,
hits
=
1
)
with
PRIORITYMAP_LOCK
:
benchmark
[
name
]
=
Benchmark
(
num
=
length
,
duration
=
dt
,
hits
=
1
)
else
:
else
:
num
,
duration
,
hits
=
benchmark
[
name
]
num
,
duration
,
hits
=
benchmark
[
name
]
num
=
int
(((
num
*
hits
)
+
length
)
/
float
(
hits
+
1
))
num
=
int
(((
num
*
hits
)
+
length
)
/
float
(
hits
+
1
))
...
@@ -191,7 +192,8 @@ class CatalogPlan(object):
...
@@ -191,7 +192,8 @@ class CatalogPlan(object):
if
hits
%
REFRESH_RATE
==
0
:
if
hits
%
REFRESH_RATE
==
0
:
hits
=
0
hits
=
0
hits
+=
1
hits
+=
1
benchmark
[
name
]
=
Benchmark
(
num
,
duration
,
hits
)
with
PRIORITYMAP_LOCK
:
benchmark
[
name
]
=
Benchmark
(
num
,
duration
,
hits
)
def
stop
(
self
):
def
stop
(
self
):
self
.
end_time
=
time
.
time
()
self
.
end_time
=
time
.
time
()
...
@@ -203,20 +205,6 @@ class CatalogPlan(object):
...
@@ -203,20 +205,6 @@ class CatalogPlan(object):
with
PRIORITYMAP_LOCK
:
with
PRIORITYMAP_LOCK
:
PRIORITYMAP
[
key
]
=
benchmark
PRIORITYMAP
[
key
]
=
benchmark
# calculate mean time of search
stats
=
getattr
(
self
.
catalog
,
'_v_stats'
,
None
)
if
stats
is
None
:
stats
=
self
.
catalog
.
_v_stats
=
{}
if
key
not
in
stats
:
mt
=
self
.
duration
hits
=
1
else
:
mt
,
hits
=
stats
[
key
]
mt
=
((
mt
*
hits
)
+
self
.
duration
)
/
float
(
hits
+
1
)
hits
+=
1
stats
[
key
]
=
(
mt
,
hits
)
self
.
log
()
self
.
log
()
def
log
(
self
):
def
log
(
self
):
...
...
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