💾 Archived View for tris.fyi › pydoc › _lsprof captured on 2023-01-29 at 03:44:37. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-01-08)

🚧 View Differences

-=-=-=-=-=-=-

Back to module index

Go to module by name

_lsprof

Fast profiler

Classes

Profiler

Profiler(timer=None, timeunit=None, subcalls=True, builtins=True)

    Builds a profiler object using the specified timer function.
    The default timer is a fast built-in one based on real time.
    For custom timer functions returning integers, timeunit can
    be a float specifying a scale (i.e. how long each integer unit
    is, in seconds).

clear(...)

  clear()

  Clear all profiling information collected so far.

disable(...)

  disable()

  Stop collecting profiling information.

enable(...)

  enable(subcalls=True, builtins=True)

  Start collecting profiling information.
  If 'subcalls' is True, also records for each function
  statistics separated according to its current caller.
  If 'builtins' is True, records the time spent in
  built-in functions separately from their caller.

getstats(self, /)

  list of profiler_entry objects.

  getstats() -> list of profiler_entry objects

  Return all information collected by the profiler.
  Each profiler_entry is a tuple-like object with the
  following attributes:

      code          code object
      callcount     how many times this was called
      reccallcount  how many times called recursively
      totaltime     total time in this entry
      inlinetime    inline time in this entry (not in subcalls)
      calls         details of the calls

  The calls attribute is either None or a list of
  profiler_subentry objects:

      code          called code object
      callcount     how many times this is called
      reccallcount  how many times this is called recursively
      totaltime     total time spent in this call
      inlinetime    inline time (not in further subcalls)

profiler_entry

count(self, value, /)

  Return number of occurrences of value.
index(self, value, start=0, stop=9223372036854775807, /)

  Return first index of value.

  Raises ValueError if the value is not present.
callcount = <member 'callcount' of '_lsprof.profiler_entry' objects>
  how many times this was called
calls = <member 'calls' of '_lsprof.profiler_entry' objects>
  details of the calls
code = <member 'code' of '_lsprof.profiler_entry' objects>
  code object or built-in function name
inlinetime = <member 'inlinetime' of '_lsprof.profiler_entry' objects>
  inline time in this entry (not in subcalls)
n_fields = 6
n_sequence_fields = 6
n_unnamed_fields = 0
reccallcount = <member 'reccallcount' of '_lsprof.profiler_entry' objects>
  how many times called recursively
totaltime = <member 'totaltime' of '_lsprof.profiler_entry' objects>
  total time in this entry

profiler_subentry

count(self, value, /)

  Return number of occurrences of value.
index(self, value, start=0, stop=9223372036854775807, /)

  Return first index of value.

  Raises ValueError if the value is not present.
callcount = <member 'callcount' of '_lsprof.profiler_subentry' objects>
  how many times this is called
code = <member 'code' of '_lsprof.profiler_subentry' objects>
  called code object or built-in function name
inlinetime = <member 'inlinetime' of '_lsprof.profiler_subentry' objects>
  inline time (not in further subcalls)
n_fields = 5
n_sequence_fields = 5
n_unnamed_fields = 0
reccallcount = <member 'reccallcount' of '_lsprof.profiler_subentry' objects>
  how many times this is called recursively
totaltime = <member 'totaltime' of '_lsprof.profiler_subentry' objects>
  total time spent in this call