Ejemplo n.º 1
0
 def content(self):
     context = dict(
         template_calls = self.do_stat_call('get_total_calls'),
         template_time = self.do_stat_call('get_total_time'),
         template_calls_list = [(c['time'], c['args'][1], 'jinja2', c['stack']) for c in get_stats().get_calls('templates:jinja2')] + \
                 [(c['time'], c['args'][1], 'jinja', c['stack']) for c in get_stats().get_calls('templates:jinja')] + \
                 [(c['time'], c['args'][0].name, 'django', c['stack']) for c in get_stats().get_calls('templates:django')],
     )
     return render_to_string('debug_toolbar/panels/templates.html', context)
Ejemplo n.º 2
0
 def content(self):
     context = dict(
         cache_calls=get_stats().get_total_calls("cache"),
         cache_time=get_stats().get_total_time("cache"),
         cache_hits=get_stats().get_total_hits("cache"),
         cache_misses=get_stats().get_total_misses_for_function("cache", cache.get)
         + get_stats().get_total_misses_for_function("cache", cache.get_many),
         cache_gets=get_stats().get_total_calls_for_function("cache", cache.get),
         cache_sets=get_stats().get_total_calls_for_function("cache", cache.set),
         cache_get_many=get_stats().get_total_calls_for_function("cache", cache.get_many),
         cache_deletes=get_stats().get_total_calls_for_function("cache", cache.delete),
         cache_calls_list=[
             (c["time"], c["func"].__name__, c["args"], c["kwargs"], simplejson.dumps(c["stack"]))
             for c in get_stats().get_calls("cache")
         ],
     )
     return render_to_string("debug_toolbar/panels/cache.html", context)
Ejemplo n.º 3
0
 def do_stat_call(self, name):
     result = None
     for t in self.engine_list:
         r = getattr(get_stats(), name)('templates:%s' % (t,))
         if result:
             result += r
         else:
             result = r
     return result
Ejemplo n.º 4
0
 def content(self):
     context = dict(
         cache_calls = get_stats().get_total_calls('cache'),
         cache_time = get_stats().get_total_time('cache'),
         cache_hits = get_stats().get_total_hits('cache'),
         cache_misses = get_stats().get_total_misses_for_function('cache', cache.get) + get_stats().get_total_misses_for_function('cache', cache.get_many),
         cache_gets = get_stats().get_total_calls_for_function('cache', cache.get),
         cache_sets = get_stats().get_total_calls_for_function('cache', cache.set),
         cache_get_many = get_stats().get_total_calls_for_function('cache', cache.get_many),
         cache_deletes = get_stats().get_total_calls_for_function('cache', cache.delete),
         cache_calls_list = [(c['time'], c['func'].__name__, c['args'][0], c['args'][1:], c['kwargs'], c['stack']) for c in get_stats().get_calls('cache')],
     )
     return render_to_string('debug_toolbar/panels/cache.html', context)
Ejemplo n.º 5
0
 def has_content(self):
     return bool(get_stats().get_total_calls("cache"))
Ejemplo n.º 6
0
 def title(self):
     return "Cache: %.2fms" % get_stats().get_total_time("cache")
Ejemplo n.º 7
0
 def title(self):
     return 'Cache: %.2fms' % get_stats().get_total_time('cache')