Elements runtime reference / Diagnostics

timeBlock

Record helper timing metadata for named code blocks.

Signatuur

timeBlock(name) / measureTime(name, func, *args, **kwargs)

Doel

Record helper timing metadata for named code blocks.

Aliases and imports

  • time_block
  • measureTime
  • measure_time

Payloadformaat

Use these fields as the Python call arguments or keyword payload for this helper.

{
  "name": "fetch-api",
  "style": "with timeBlock(name): ..."
}
FieldDescription
nameTiming label.
funcCallable for measureTime.
args/kwargsArguments forwarded to func by measureTime.

Return payload

timeBlock is a context manager; measureTime returns the callable result.

Voorbeeld

def run():
    with timeBlock("fetch-api"):
        rows = fetch_rows()
    total = measureTime("count-rows", lambda: len(rows))
    return {"rows": total}

Scope-notities