bundle.testing.tools.decorators.cprofile ======================================== .. py:module:: bundle.testing.tools.decorators.cprofile Attributes ---------- .. autoapisummary:: bundle.testing.tools.decorators.cprofile.log bundle.testing.tools.decorators.cprofile.ENABLED bundle.testing.tools.decorators.cprofile.EXPECTED_DURATION_NS bundle.testing.tools.decorators.cprofile.PERFORMANCE_THRESHOLD_NS Classes ------- .. autoapisummary:: bundle.testing.tools.decorators.cprofile.ProfileContext Functions --------- .. autoapisummary:: bundle.testing.tools.decorators.cprofile.get_cprofile_enabled bundle.testing.tools.decorators.cprofile.set_cprofile_enabled bundle.testing.tools.decorators.cprofile.cprofile Module Contents --------------- .. py:data:: log .. py:data:: ENABLED :type: bool :value: False .. py:data:: EXPECTED_DURATION_NS :type: int :value: 100000000 .. py:data:: PERFORMANCE_THRESHOLD_NS :type: int :value: 100000000 .. py:function:: get_cprofile_enabled() -> bool .. py:function:: set_cprofile_enabled(value: bool) -> None .. py:class:: ProfileContext(expected_duration: int, performance_threshold: int, cprofile_folder: pathlib.Path | None, func_name: str, result_identifier: collections.abc.Callable[[Any], str]) Context manager that profiles an async function execution, logs execution time, dumps stats, and warns if performance thresholds are exceeded. .. py:attribute:: expected_duration .. py:attribute:: performance_threshold .. py:attribute:: cprofile_folder .. py:attribute:: func_name .. py:attribute:: result_identifier .. py:attribute:: profiler .. py:attribute:: start_ns :type: int | None :value: None .. py:attribute:: elapsed_ns :type: int | None :value: None .. py:attribute:: result :type: Any :value: None .. py:function:: cprofile(expected_duration: int = EXPECTED_DURATION_NS, performance_threshold: int = PERFORMANCE_THRESHOLD_NS, cprofile_folder: pathlib.Path | None = None) -> collections.abc.Callable[[collections.abc.Callable[Ellipsis, Any]], collections.abc.Callable[Ellipsis, Any]]