module profiling._event_profiler_c

Short summary

module cpyquickhelper.profiling._event_profiler_c

Event Profiler with the C Python API.

source on GitHub

Functions

function

truncated documentation

_profiling_delete

Release all references on stored python objects.

_profiling_dump_and_clear

Copies the buffer into another one allocated before calling this method.The function does not lock the :epkg:`GIL`.

_profiling_get_saved_maps

Returns a tuple with two dictionaries. One for all the event frames, a second one for the event arguments.

_profiling_log_event

Logs an event.

_profiling_n_columns

Returns the number of informations stored per event. Total size must be multiplied sizeof(int64_t).

_profiling_register_pyinstance

Registers an object called when the buffer is full. This one should call @see fn _profiling_dump_and_clear to empty the …

_profiling_start

Starts the profiler. One instance is stored in a static pointer.

_profiling_stop

Stops the profiler. The function checks that the profiler was emptied. The static instance is removed.

dummy_capsule

Returns a dummy capsule with 128 uint32_t.

get_memory_content

Returns the content of the memory between addresses [ptr, ptr+size[ where ptr is the pointer held by the capsule.

Documentation

Event Profiler with the C Python API.

cpyquickhelper.profiling._event_profiler_c._profiling_delete()

Release all references on stored python objects.

cpyquickhelper.profiling._event_profiler_c._profiling_dump_and_clear()

Copies the buffer into another one allocated before calling this method.The function does not lock the :epkg:`GIL`.

Parameters:
  • ptr – pointer on numpy array, something like .__array_interface__[‘data’][0]

  • size – buffer size (it must be higher than the buffer size of the profiler

  • lock – locks the profiler while copying the buffer

cpyquickhelper.profiling._event_profiler_c._profiling_get_saved_maps()

Returns a tuple with two dictionaries. One for all the event frames, a second one for the event arguments.

cpyquickhelper.profiling._event_profiler_c._profiling_log_event()

Logs an event.

Parameters:
  • frame – frame

  • event – a string describing the event

  • arg – additional argument (used for built-in functions)

cpyquickhelper.profiling._event_profiler_c._profiling_n_columns()

Returns the number of informations stored per event. Total size must be multiplied sizeof(int64_t).

Returns:

size

cpyquickhelper.profiling._event_profiler_c._profiling_register_pyinstance()

Registers an object called when the buffer is full. This one should call @see fn _profiling_dump_and_clear to empty the cached.

Parameters:

fct – instance of the python object implementing method _empty_cache

cpyquickhelper.profiling._event_profiler_c._profiling_start()

Starts the profiler. One instance is stored in a static pointer.

Parameters:
  • size – buffer size (number of stored events)

  • bool – unused

cpyquickhelper.profiling._event_profiler_c._profiling_stop()

Stops the profiler. The function checks that the profiler was emptied. The static instance is removed.

cpyquickhelper.profiling._event_profiler_c.dummy_capsule()

Returns a dummy capsule with 128 uint32_t.

Parameters:

name – name of the capsule’s pointer

Returns:

capsule

cpyquickhelper.profiling._event_profiler_c.get_memory_content()

Returns the content of the memory between addresses [ptr, ptr+size[ where ptr is the pointer held by the capsule.

Parameters:
  • caps – capsule

  • name – pointer’s name

  • size – size in bytes

Returns:

array of uint32_t