struct
Bench
Defines the main Benchmark struct which executes a Benchmark and print result.
Fields
- config (
BenchConfig
): Constructs a Benchmark object based on specific configuration and mode. - mode (
Mode
): Benchmark mode object representing benchmark or test mode. - info_vec (
List[BenchmarkInfo]
): A list containing the bencmark info.
Implemented traits
AnyType
,
Copyable
,
Movable
Methods
__init__
__init__(inout self: Self, config: Optional[BenchConfig] = #kgen.none, mode: Mode = 0)
Constructs a Benchmark object based on specific configuration and mode.
Args:
- config (
Optional[BenchConfig]
): Benchmark configuration object to control length and frequency of benchmarks. - mode (
Mode
): Benchmark mode object representing benchmark or test mode.
bench_with_input
bench_with_input[T: AnyType, bench_fn: fn(inout Bencher, $0) capturing -> None](inout self: Self, bench_id: BenchId, input: T, throughput_elems: Optional[Int] = #kgen.none, measures: List[ThroughputMeasure] = List())
Benchmarks an input function with input args of type AnyType.
Parameters:
- T (
AnyType
): Benchmark function input type. - bench_fn (
fn(inout Bencher, $0) capturing -> None
): The function to be benchmarked.
Args:
- bench_id (
BenchId
): The benchmark Id object used for identification. - input (
T
): Represents the target function's input arguments. - throughput_elems (
Optional[Int]
): Optional argument representing algorithmic throughput. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
bench_with_input[T: AnyTrivialRegType, bench_fn: fn(inout Bencher, $0) capturing -> None](inout self: Self, bench_id: BenchId, input: T, throughput_elems: Optional[Int] = #kgen.none, measures: List[ThroughputMeasure] = List())
Benchmarks an input function with input args of type AnyTrivialRegType.
Parameters:
- T (
AnyTrivialRegType
): Benchmark function input type. - bench_fn (
fn(inout Bencher, $0) capturing -> None
): The function to be benchmarked.
Args:
- bench_id (
BenchId
): The benchmark Id object used for identification. - input (
T
): Represents the target function's input arguments. - throughput_elems (
Optional[Int]
): Optional argument representing algorithmic throughput. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
bench_function
bench_function[bench_fn: fn(inout Bencher) capturing -> None](inout self: Self, bench_id: BenchId, throughput_elems: Optional[Int] = #kgen.none, measures: List[ThroughputMeasure] = List())
Benchmarks or Tests an input function.
Parameters:
- bench_fn (
fn(inout Bencher) capturing -> None
): The function to be benchmarked.
Args:
- bench_id (
BenchId
): The benchmark Id object used for identification. - throughput_elems (
Optional[Int]
): Optional argument representing algorithmic throughput. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
bench_function[bench_fn: fn(inout Bencher) raises capturing -> None](inout self: Self, bench_id: BenchId, throughput_elems: Optional[Int] = #kgen.none, measures: List[ThroughputMeasure] = List())
Benchmarks or Tests an input function.
Parameters:
- bench_fn (
fn(inout Bencher) raises capturing -> None
): The function to be benchmarked.
Args:
- bench_id (
BenchId
): The benchmark Id object used for identification. - throughput_elems (
Optional[Int]
): Optional argument representing algorithmic throughput. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
dump_report
dump_report(self: Self)
Prints out the report from a Benchmark execution.