MCPcopy Create free account
hub / github.com/InternLM/InternBootcamp / marked_timer

Function marked_timer

verl/verl/utils/profiler/performance.py:172–195  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

170
171@contextmanager
172def 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
198def reduce_timing(

Callers 15

_validate_wrapperMethod · 0.90
fitMethod · 0.90
_log_validation_dataMethod · 0.90
_validate_processMethod · 0.90
_log_rollout_dataMethod · 0.50
fitMethod · 0.50
_log_rollout_dataMethod · 0.50
fitMethod · 0.50
_async_gen_next_batchMethod · 0.50
fitMethod · 0.50

Calls 1

_timerFunction · 0.85

Tested by

no test coverage detected