IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.1.0
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

Report

struct Report

Contains the average execution time, iterations, min and max of each batch.

Fields​

  • ​warmup_duration (Int): The total duration it took to warmup.
  • ​runs (List[Batch]): A List of benchmark runs.

Implemented traits​

AnyType, Copyable, Defaultable, Deinitable, Movable

Methods​

__init__​

def __init__(out self)

Default initializer for the Report.

Sets all values to 0

iters​

def iters(self) -> Int

The total benchmark iterations.

Returns:

Int: The total benchmark iterations.

duration​

def duration(self, unit: String = Unit.s) -> Float64

The total duration it took to run all benchmarks.

Args:

  • ​unit (String): The time unit to display for example: ns, us, ms, s (default s).

Returns:

Float64: The total duration it took to run all benchmarks.

mean​

def mean(self, unit: String = Unit.s) -> Float64

The average duration of all benchmark runs.

Args:

  • ​unit (String): The time unit to display for example: ns, us, ms, s (default s).

Returns:

Float64: The average duration of all benchmark runs.

min​

def min(self, unit: String = Unit.s) -> Float64

The batch of benchmarks that was the fastest to run.

Args:

  • ​unit (String): The time unit to display for example: ns, us, ms, s (default s).

Returns:

Float64: The fastest duration out of all batches.

max​

def max(self, unit: String = Unit.s) -> Float64

The batch of benchmarks that was the slowest to run.

Args:

  • ​unit (String): The time unit to display for example: ns, us, ms, s (default s).

Returns:

Float64: The slowest duration out of all batches.

as_string​

def as_string(self, unit: String = Unit.s) -> String

Converts the Report to a String.

Args:

  • ​unit (String): The time unit to display for example: ns, us, ms, s (default s).

Returns:

String: The string representation of the Report.

print​

def print(self, unit: String = Unit.s)

Prints out the shortened version of the report.

Args:

  • ​unit (String): The time unit to display for example: ns, us, ms, s (default s).

def print_full(self, unit: String = Unit.s)

Prints out the full version of the report with each batch of benchmark runs.

Args:

  • ​unit (String): The time unit to display for example: ns, us, ms, s (default s).