コード例 #1
0
    def process_complete(self, request):
        from devserver.utils.stats import stats

        calls = stats.get_total_calls('cache')
        hits = stats.get_total_hits('cache')
        misses = stats.get_total_misses_for_function(
            'cache', cache.get) + stats.get_total_misses_for_function(
                'cache', cache.get_many)

        if calls:
            ratio = int(hits / float(misses + hits) * 100)
        else:
            ratio = 100

        self.logger.info(
            '%(calls)s calls made with a %(ratio)d%% hit percentage (%(misses)s misses)'
            % dict(
                calls=calls,
                ratio=ratio,
                hits=hits,
                misses=misses,
            ),
            duration=stats.get_total_time('cache'))

        # set our attributes back to their defaults
        for k, v in self.old.iteritems():
            setattr(cache, k, v)
コード例 #2
0
    def process_complete(self, request):
        from devserver.utils.stats import stats

        calls = stats.get_total_calls('cache')
        hits = stats.get_total_hits('cache')
        misses = stats.get_total_misses_for_function('cache', cache.get) + stats.get_total_misses_for_function('cache', cache.get_many)

        if calls and (hits or misses):
            ratio = int(hits / float(misses + hits) * 100)
        else:
            ratio = 100
        
        self.logger.info('%(calls)s calls made with a %(ratio)d%% hit percentage (%(misses)s misses)' % dict(
            calls = calls,
            ratio = ratio,
            hits = hits,
            misses = misses,
        ), duration=stats.get_total_time('cache'))

        # set our attributes back to their defaults
        for k, v in self.old.iteritems():
            setattr(cache, k, v)