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]): AListof benchmark runs.
Implemented traits
AnyType,
Copyable,
Defaultable,
ImplicitlyDestructible,
Movable
comptime members
__copyinit__is_trivial
comptime __copyinit__is_trivial = False
__del__is_trivial
comptime __del__is_trivial = False
__moveinit__is_trivial
comptime __moveinit__is_trivial = True
Methods
__init__
__init__(out self)
Default initializer for the Report.
Sets all values to 0
iters
duration
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 (defaults).
Returns:
Float64: The total duration it took to run all benchmarks.
mean
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 (defaults).
Returns:
Float64: The average duration of all benchmark runs.
min
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 (defaults).
Returns:
Float64: The fastest duration out of all batches.
max
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 (defaults).
Returns:
Float64: The slowest duration out of all batches.
as_string
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 (defaults).
Returns:
String: The string representation of the Report.
print
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 (defaults).
print_full
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 (defaults).
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!