Skip to main content

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))
ParameterDescriptionSchema
nameA string identifier for the code block being measured.str
no_printAn optional boolean flag indicating whether the timing information should be printed or not.bool
disable_gcAn optional boolean flag indicating whether the garbage collector should be disabled or not.bool
OpenfabricAI Robot
OpenfabricAI FooterOpenfabricAI Footer