parameters: (sig=None, frame=None)
docstring: Log statistics of ormcache usage by database, model, and method.
docstring_summary: Log statistics of ormcache usage by database, model, and method.
docstring_tokens: Log statistics of ormcache usage by database model and method .
function: def log_ormcache_stats(sig=None, frame=None):
      """ Log statistics of ormcache usage by database, model, and method. """
      from odoo.modules.registry import Registry
      import threading
  
      me = threading.currentThread()
      me_dbname = getattr(me, 'dbname', 'n/a')
  
      for dbname, reg in sorted(Registry.registries.d.items()):
          # set logger prefix to dbname
          me.dbname = dbname
          entries = Counter(k[:2] for k in reg._Registry__cache.d)
          # show entries sorted by model name, method name
          for key in sorted(entries, key=lambda key: (key[0], key[1].__name__)):
              model, method = key
              stat = STAT[(dbname, model, method)]
              _logger.info(
                  "%6d entries, %6d hit, %6d miss, %6d err, %4.1f%% ratio, for %s.%s",
                  entries[key], stat.hit, stat.miss, stat.err, stat.ratio, model, method.__name__,
              )
  
      me.dbname = me_dbname
function_tokens: def log_ormcache_stats ( sig = None , frame = None ) : from odoo . modules . registry import Registry import threading me = threading . currentThread ( ) me_dbname = getattr ( me , 'dbname' , 'n/a' ) for dbname , reg in sorted ( Registry . registries . d . items ( ) ) : # set logger prefix to dbname me . dbname = dbname entries = Counter ( k [ : 2 ] for k in reg . _Registry__cache . d ) # show entries sorted by model name, method name for key in sorted ( entries , key = lambda key : ( key [ 0 ] , key [ 1 ] . __name__ ) ) : model , method = key stat = STAT [ ( dbname , model , method ) ] _logger . info ( "%6d entries, %6d hit, %6d miss, %6d err, %4.1f%% ratio, for %s.%s" , entries [ key ] , stat . hit , stat . miss , stat . err , stat . ratio , model , method . __name__ , ) me . dbname = me_dbname