MCPcopy Create free account
hub / github.com/X-PLUG/MobileAgent / _timer

Function _timer

UI-S1/verl/utils/debug/performance.py:108–125  ·  view source on GitHub ↗

Context manager for timing code execution. This utility function measures the execution time of code within its context and accumulates the timing information in the provided dictionary. Args: name (str): The name/identifier for this timing measurement. timing_raw (Dict

(name: str, timing_raw: Dict[str, float])

Source from the content-addressed store, hash-verified

106
107@contextmanager
108def _timer(name: str, timing_raw: Dict[str, float]):
109 """Context manager for timing code execution.
110
111 This utility function measures the execution time of code within its context
112 and accumulates the timing information in the provided dictionary.
113
114 Args:
115 name (str): The name/identifier for this timing measurement.
116 timing_raw (Dict[str, float]): Dictionary to store timing information.
117
118 Yields:
119 None: This is a context manager that yields control back to the code block.
120 """
121 with Timer(name=name, logger=None) as timer:
122 yield
123 if name not in timing_raw:
124 timing_raw[name] = 0
125 timing_raw[name] += timer.last
126
127
128def reduce_timing(timing_raw: Dict[str, float]) -> Dict[str, float]:

Callers 11

fitMethod · 0.90
fitMethod · 0.90
generate_sequencesMethod · 0.90
generate_sequencesMethod · 0.90
__enter__Method · 0.90
__enter__Method · 0.90
__enter__Method · 0.90
__enter__Method · 0.90
fitMethod · 0.85
fitMethod · 0.85
fitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected