Skip to main content

Mojo function

time_function

time_function[func: fn() raises capturing -> None]() -> UInt

Measures the time spent in the function.

Parameters:

  • func (fn() raises capturing -> None): The function to time.

Returns:

UInt: The time elapsed in the function in ns.

Raises:

If the operation fails.

time_function[func: fn() capturing -> None]() -> UInt

Measures the time spent in the function.

Parameters:

  • func (fn() capturing -> None): The function to time.

Returns:

UInt: The time elapsed in the function in ns.

Was this page helpful?