Skip to main content

Mojo struct

BenchConfig

Defines a benchmark configuration struct to control execution times and frequency.

Aliases

  • VERBOSE_TIMING_LABELS = List(String("min (ms)"), String("mean (ms)"), String("max (ms)"), String("duration (ms)")): Labels to print verbose timing results.

Fields

  • out_file (Optional[Path]): Output file to write results to.
  • min_runtime_secs (SIMD[float64, 1]): Upper bound on benchmarking time in secs.
  • max_runtime_secs (SIMD[float64, 1]): Lower bound on benchmarking time in secs.
  • min_warmuptime_secs (SIMD[float64, 1]): Lower bound on warmup time in secs.
  • max_batch_size (Int): The maximum number of iterations to perform per time measurement.
  • max_iters (Int): Max number of iterations to run.
  • num_repetitions (Int): Number of times the benchmark has to be repeated.
  • flush_denormals (Bool): Whether or not the denormal values are flushed.
  • show_progress (Bool): Whether or not to show the progress of each benchmark.
  • tabular_view (Bool): Whether to print results in csv readable/tabular format.
  • verbose_timing (Bool): Whether to print verbose timing results.

Implemented traits

AnyType, CollectionElement, Copyable, Movable

Methods

__init__

__init__(out self, out_file: Optional[Path] = Optional(#kgen.none), min_runtime_secs: SIMD[float64, 1] = SIMD(#kgen.float_literal<1|1>), max_runtime_secs: SIMD[float64, 1] = SIMD(#kgen.float_literal<2|1>), min_warmuptime_secs: SIMD[float64, 1] = SIMD(#kgen.float_literal<1|1>), max_batch_size: Int = 0, max_iters: Int = 1000000000, num_repetitions: Int = 1, flush_denormals: Bool = 1)

Constructs and initializes Benchmark config object with default and inputed values.

Args:

  • out_file (Optional[Path]): Output file to write results to.
  • min_runtime_secs (SIMD[float64, 1]): Lower bound on benchmarking time in secs (default 0.1).
  • max_runtime_secs (SIMD[float64, 1]): Upper bound on benchmarking time in secs (default 1).
  • min_warmuptime_secs (SIMD[float64, 1]): Lower bound on warmup time in secs (default 1.0).
  • max_batch_size (Int): The maximum number of iterations to perform per time measurement.
  • max_iters (Int): Max number of iterations to run (default 1_000_000_000).
  • num_repetitions (Int): Number of times the benchmark has to be repeated.
  • flush_denormals (Bool): Whether or not the denormal values are flushed.

__init__(out self, *, other: Self)

Explicitly construct a deep copy of the provided value.

Args:

  • other (Self): The value to copy.