Context manager for timing with platform markers. This utility function measures the execution time of code within its context, accumulates the timing information, and adds platform markers for profiling. This function is a default implementation when hardware profiler is not available.
(
name: str,
timing_raw: dict[str, float],
color: str = None,
domain: Optional[str] = None,
category: Optional[str] = None,
)
| 170 | |
| 171 | @contextmanager |
| 172 | def marked_timer( |
| 173 | name: str, |
| 174 | timing_raw: dict[str, float], |
| 175 | color: str = None, |
| 176 | domain: Optional[str] = None, |
| 177 | category: Optional[str] = None, |
| 178 | ): |
| 179 | """Context manager for timing with platform markers. |
| 180 | |
| 181 | This utility function measures the execution time of code within its context, |
| 182 | accumulates the timing information, and adds platform markers for profiling. |
| 183 | This function is a default implementation when hardware profiler is not available. |
| 184 | |
| 185 | Args: |
| 186 | name (str): The name/identifier for this timing measurement. |
| 187 | timing_raw (Dict[str, float]): Dictionary to store timing information. |
| 188 | color (Optional[str]): Color for the marker. Defaults to None. |
| 189 | domain (Optional[str]): Domain for the marker. Defaults to None. |
| 190 | category (Optional[str]): Category for the marker. Defaults to None. |
| 191 | |
| 192 | Yields: |
| 193 | None: This is a context manager that yields control back to the code block. |
| 194 | """ |
| 195 | yield from _timer(name, timing_raw) |
| 196 | |
| 197 | |
| 198 | def reduce_timing( |
no test coverage detected