Skip to main content
Log in

Mojo struct

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, CollectionElement, Copyable, ExplicitlyCopyable, Movable, UnknownDestructibility

Methods

__init__

__init__(out self)

Default initializer for the Report.

Sets all values to 0

__init__(out self, *, other: Self)

Explicitly construct a deep copy of the provided value.

Args:

  • other (Self): The value to copy.

__copyinit__

__copyinit__(out self, existing: Self)

Creates a shallow copy (it doesn't copy the data).

Args:

  • existing (Self): The Report to copy.

iters

iters(self) -> Int

The total benchmark iterations.

Returns:

The total benchmark iterations.

duration

duration(self, unit: String = String("s")) -> SIMD[float64, 1]

The total duration it took to run all benchmarks.

Args:

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

Returns:

The total duration it took to run all benchmarks.

mean

mean(self, unit: String = String("s")) -> SIMD[float64, 1]

The average duration of all benchmark runs.

Args:

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

Returns:

The average duration of all benchmark runs.

min

min(self, unit: String = String("s")) -> SIMD[float64, 1]

The batch of benchmarks that was the fastest to run.

Args:

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

Returns:

The fastest duration out of all batches.

max

max(self, unit: String = String("s")) -> SIMD[float64, 1]

The batch of benchmarks that was the slowest to run.

Args:

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

Returns:

The slowest duration out of all batches.

print

print(self, unit: String = String("s"))

Prints out the shortened version of the report.

Args:

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

print_full(self, unit: String = String("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, ms, s (default s).