--- a/web/views/debug.py Tue Feb 10 14:37:51 2015 +0100
+++ b/web/views/debug.py Tue Feb 10 14:38:25 2015 +0100
@@ -186,31 +186,13 @@
cache_max_age = 0
def call(self, **kwargs):
- from cubicweb._gcdebug import gc_info
- from rql.stmts import Union
- from cubicweb.appobject import AppObject
- from cubicweb.rset import ResultSet
- from cubicweb.dbapi import Connection, Cursor
- from cubicweb.web.request import CubicWebRequestBase
- lookupclasses = (AppObject,
- Union, ResultSet,
- Connection, Cursor,
- CubicWebRequestBase)
- try:
- from cubicweb.server.session import Session, InternalSession
- lookupclasses += (InternalSession, Session)
- except ImportError:
- pass # no server part installed
+ stats = self._cw.call_service('repo_gc_stats')
self.w(u'<h2>%s</h2>' % _('Garbage collection information'))
- counters, ocounters, garbage = gc_info(lookupclasses,
- viewreferrersclasses=())
self.w(u'<h3>%s</h3>' % self._cw._('Looked up classes'))
- values = sorted(counters.iteritems(), key=lambda x: x[1], reverse=True)
- self.wview('pyvaltable', pyvalue=values)
+ self.wview('pyvaltable', pyvalue=stats['lookupclasses'])
self.w(u'<h3>%s</h3>' % self._cw._('Most referenced classes'))
- values = sorted(ocounters.iteritems(), key=lambda x: x[1], reverse=True)
- self.wview('pyvaltable', pyvalue=values[:self._cw.form.get('nb', 20)])
- if garbage:
+ self.wview('pyvaltable', pyvalue=stats['referenced'])
+ if stats['unreachable']:
self.w(u'<h3>%s</h3>' % self._cw._('Unreachable objects'))
- values = sorted(xml_escape(repr(o)) for o in garbage)
+ values = [xml_escape(val) for val in stats['unreachable']]
self.wview('pyvallist', pyvalue=values)