Example #1
0
 def nav_subtitle(self):
     if not self.is_active or not cache_available:
         return 'Unavailable'
     # Aggregate stats.
     stats = {'hit': 0, 'miss': 0, 'time': 0}
     for log in get_debug_requests():
         stats[log.hit and 'hit' or 'miss'] += 1
         stats['time'] += log.duration
     stats['time'] = round(stats['time'], 2)
     return '%(hit)s hits, %(miss)s misses in %(time)sms' % stats
Example #2
0
    def content(self):
        if not self.is_active or not cache_available:
            return 'Cache profiler not activated'
        requests = []
        counter = 0

        for log in get_debug_requests():
            requests.append({'id': counter,
                             'hit': log.hit,
                             'method': log.method,
                             'parameters': log.parameters,
                             'result': log.result,
                             'duration': log.duration,
                             'context': format_fname(log.context)})
            counter += 1
        return self.render('panels/cache.html', {'requests': requests})
Example #3
0
 def has_content(self):
     if not cache_available:
         return False
     return bool(get_debug_requests())