profiling
profiling_end(ctx: Optional[tuple[cProfile.Profile, Callable[[str], str]]], identifier: str)
¶
Stop profiling and save results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Optional[tuple[Profile, Callable[[str], str]]]
|
(Profile, session) tuple from profiling_start, or None. |
required |
identifier
|
str
|
Identifier for the profiling stage (e.g., "solve", "initialize"). |
required |
Source code in openscvx/utils/profiling.py
profiling_start(profiling_enabled: bool, session: Optional[Callable[[str], str]] = None) -> Optional[tuple[cProfile.Profile, Callable[[str], str]]]
¶
Start profiling if enabled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profiling_enabled
|
bool
|
Whether to enable profiling. |
required |
session
|
Optional[Callable[[str], str]]
|
Existing session to reuse. If None, a new session is created. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[tuple[Profile, Callable[[str], str]]]
|
(Profile, session) tuple if enabled, None otherwise. |