def log_ormcache_stats(sig=None, frame=None):
 from odoo.modules.registry import Registry
 import threading
 me = threading.currentThread()
 me_dbname = me.dbname
 entries = defaultdict(int)
 for (dbname, reg) in Registry.registries.iteritems():
  for key in reg.cache.iterkeys():
   entries[((dbname,) + key[:2])] += 1
 for (key, count) in sorted(entries.items()):
  (dbname, model_name, method) = key
  me.dbname = dbname
  stat = STAT[key]
  _logger.info('%6d entries, %6d hit, %6d miss, %6d err, %4.1f%% ratio, for %s.%s', count, stat.hit, stat.miss, stat.err, stat.ratio, model_name, method.__name__)
 me.dbname = me_dbname

def log_ormcache_stats ( sig = None , frame = None ) : from odoo . modules . registry import Registry import threading me = threading . currentThread ( ) me_dbname = me . dbname entries = defaultdict ( int ) for ( dbname , reg ) in Registry . registries . iteritems ( ) : for key in reg . cache . iterkeys ( ) : entries [ ( ( dbname , ) + key [ : 2 ] ) ] += 1 for ( key , count ) in sorted ( entries . items ( ) ) : ( dbname , model_name , method ) = key me . dbname = dbname stat = STAT [ key ] _logger . info ( '%6d entries, %6d hit, %6d miss, %6d err, %4.1f%% ratio, for %s.%s' , count , stat . hit , stat . miss , stat . err , stat . ratio , model_name , method . __name__ ) me . dbname = me_dbname
log statistics of ormcache usage by database .