Commit 6de4ee54 authored by Hanno Schlichting's avatar Hanno Schlichting

Extend the query report with information about the resultset length

parent 3578c5d2
......@@ -520,7 +520,6 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
r = _apply_index(query, rs)
else:
r = _apply_index(query)
cr.split(i)
if r is not None:
r, u = r
......@@ -529,10 +528,14 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
# once we don't need to support the "return everything" case
# anymore
if r is not None and not r:
cr.split(i, 0)
return LazyCat([])
cr.split(i, len(r))
w, rs = weightedIntersection(rs, r)
if not rs:
break
else:
cr.split(i, 0)
cr.stop()
......
......@@ -25,7 +25,7 @@
</td>
<td align="left" valign="top">
<div class="list-nav">
Recent duration&nbsp;[ms]
Recent
</div>
</td>
</tr>
......@@ -53,11 +53,12 @@
</td>
<td align="left" valign="top">
<div class="list-item">
<dtml-var expr="'%3.2f' % last['duration']">
<dtml-var expr="'%3.2f' % last['duration']">ms
[<dtml-in expr="last['details']" sort mapping>
&dtml-id;:&nbsp;<dtml-var expr="'%3.2f' % duration">
&dtml-id;:
<dtml-var expr="'%3.2f' % duration">ms /
&dtml-length; objects,
</dtml-in>]
</div>
</td>
</tr>
......
......@@ -48,7 +48,7 @@ def determine_value_indexes(indexes):
for name, index in indexes.items():
if IUniqueValueIndex.providedBy(index):
values = index.uniqueValues()
if values and len(values) < MAX_DISTINCT_VALUES:
if values and len(list(values)) < MAX_DISTINCT_VALUES:
# Only consider indexes which actually return a number
# greater than zero
new_value_indexes.add(name)
......@@ -117,7 +117,7 @@ class StopWatch(object):
self.init()
self.start_time = time.time()
def split(self, label):
def split(self, label, result_length=None):
current = time.time()
start_time, stop_time = self.interim.get(label, (None, None))
......@@ -126,7 +126,7 @@ class StopWatch(object):
return
self.interim[label] = (start_time, current)
self.res.append((label, current - start_time))
self.res.append((label, current - start_time, result_length))
def stop(self):
self.end_time = time.time()
......@@ -210,6 +210,7 @@ class CatalogReport(StopWatch):
<duration of single indexes> := [{'id': <index_name1>,
'duration': <duration>,
'length': <resultset length>,
},
...
]
......@@ -224,7 +225,8 @@ class CatalogReport(StopWatch):
'duration': v[1] * 1000,
'last': {'duration': v[2][0] * 1000,
'details': [dict(id=i[0],
duration=i[1]*1000)
duration=i[1]*1000,
length=i[2])
for i in v[2][1]],
},
}
......
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