common.timing

Attributes

_TIMER_REGISTRY

Functions

timed(→ collections.abc.Callable[Ellipsis, Any])

Timing decorator function to measure time spent on a function call.

write_timings(→ None)

Write the MPI averaged timings to a text file.

Module Contents

common.timing._TIMER_REGISTRY: list[str] = [][source]
common.timing.timed(timer: str | None | collections.abc.Callable[Ellipsis, Any] = None) → collections.abc.Callable[Ellipsis, Any][source]

Timing decorator function to measure time spent on a function call.

Use it with

@timed
def slow_function():
    ...

where a dolfinx timer entry will be created with the function name and stored in the global list _TIMER_REGISTRY. To set a timer name that differs from the function name:

@timed("simple name")
def _private_function_with_long_name():
    ...
common.timing.write_timings(file_path: str | os.PathLike[str]) → None[source]

Write the MPI averaged timings to a text file.

Parameters:

file_path – path of text file to write timings to