cpyquickhelper.profiling¶
Capsules¶
Not really related to profiling but maybe useful.
cpyquickhelper.profiling._event_profiler_c.dummy_capsule
Returns a dummy capsule with 128 uint32_t.
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.
C++ classes¶
cpyquickhelper.profiling._event_profiler.CEventProfilerEvent
(self, args, kwargs)
Description of an event logged by the the class @see cl CEventProfiler.
cpyquickhelper.profiling._event_profiler.CEventProfiler
(self, size)
C++ buffer for @see cl EventProfiler.
Profiler¶
cpyquickhelper.profiling.EventProfiler
(self, size = 1000000, impl = ‘python’)
This profiler profiles both memory and function calls. It stores events and produces a timeline. See EventProfiler for an example of use.
cpyquickhelper.profiling.WithEventProfiler
(self, size = 1000000, impl = ‘python’, clean_file_name = None)
Enables profiling with the following syntax…
C Profiler based on Python API¶
These functions partially implement an event profiler relying on Python C API. The call to the function logging an event is much faster than a python call.
cpyquickhelper.profiling._event_profiler_c._profiling_start
Starts the profiler. One instance is stored in a static pointer.
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._profiling_delete
Release all references on stored python objects.
cpyquickhelper.profiling._event_profiler_c._profiling_n_columns
(int64_t)
Returns the number of informations stored per event. Total size must be multiplied sizeof(int64_t).
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.
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`.
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.