How it works...

After adding the profile decorator on your method, when you call that method, Odoo will print the full statistics in the log, as shown in the previous example. It will print the statistics in three columns. The first column will contain the number of calls or how many times a line is executed. (This number will increase when the line is inside a for loop or the method is recursive). The second column represents the number of queries fired with the given line. The last column is the time taken by the given line in milliseconds. Note that the time displayed in this column is relative; it is faster when the profiler is off.

The profiler decorator accepts some optional arguments, which help you to get detailed statistics of the method. The following is the signature of the profile decorator:

def profile(method=None, whitelist=None, blacklist=(None,), files=None,
minimum_time=0, minimum_queries=0):

The following is a list of parameters supported by the profile() method:

  • whitelist: This parameter will accept a list of model names to display in the log.
  • files: This parameter will accept a list of filenames to display.
  • blacklist: This parameter will accept a list of model names that you do not want to display in the log.
  • minimum_time: This will accept an integer value (in milliseconds). It will hide logs whose total time is less than the given amount.
  • minimum_queries: This will accept an integer value of the number of queries. It will hide the logs whose total number of queries is less than the given amount.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset