MeasureBlockTime class
This class, MeasureBlockTime, is a context manager for measuring the execution time of a block of code. It records the time taken to execute the code and adds the measurement to the timing statistics with a specified name.
from openfabric_pysdk.benchmark import MeasureBlockTime
def execute(request: InputClass, ray: Ray, state: State) -> OutputClass:
with MeasureBlockTime("Measure app operations"):
...
output.append(processed_data)
return SchemaUtil.create(OutputClass(), dict(user_output=output))
Parameter | Description | Schema |
---|---|---|
name | A string identifier for the code block being measured. | str |
no_print | An optional boolean flag indicating whether the timing information should be printed or not. | bool |
disable_gc | An optional boolean flag indicating whether the garbage collector should be disabled or not. | bool |