bundle.testing.tools.decorators.cprofile

Attributes

Classes

ProfileContext

Context manager that profiles an async function execution,

Functions

Module Contents

bundle.testing.tools.decorators.cprofile.log
bundle.testing.tools.decorators.cprofile.ENABLED: bool = False
bundle.testing.tools.decorators.cprofile.EXPECTED_DURATION_NS: int = 100000000
bundle.testing.tools.decorators.cprofile.PERFORMANCE_THRESHOLD_NS: int = 100000000
bundle.testing.tools.decorators.cprofile.get_cprofile_enabled() bool[source]
bundle.testing.tools.decorators.cprofile.set_cprofile_enabled(value: bool) None[source]
class bundle.testing.tools.decorators.cprofile.ProfileContext(expected_duration: int, performance_threshold: int, cprofile_folder: pathlib.Path | None, func_name: str, result_identifier: collections.abc.Callable[[Any], str])[source]

Context manager that profiles an async function execution, logs execution time, dumps stats, and warns if performance thresholds are exceeded.

expected_duration
performance_threshold
cprofile_folder
func_name
result_identifier
profiler
start_ns: int | None = None
elapsed_ns: int | None = None
result: Any = None
bundle.testing.tools.decorators.cprofile.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]][source]