Interface
interface BenchInputProvider
public interface BenchInputProvider<T> <: BenchmarkInputMarker {
mut func get(idx: Int64): T
mut func reset(max: Int64)
}
Description: Specifies the interface used to handle performance testing. handle performance testing. It requires executing specific code before each invocation of the performance test. When the input for the performance test changes, the input data must be regenerated from scratch each time. To use this function, your DataStrategy implementation should return the implementer of this interface. The recommended method is to use the @Strategy macro.
Parent Type:
mut func get(Int64)
mut func get(idx: Int64): T
Description: Obtains elements. Its execution time is included in the benchmark measurement and then excluded from the result as part of the framework overhead.
Parameters:
- idx: Int64: element index
Returns:
- T: element value
mut func reset(Int64)
mut func reset(max: Int64)
Description: Calls this function before the benchmark measurement. After this function is called, subsequent get(i)
calls must successfully obtain the value of i
in [0, max).
Parameters:
- max: Int64: maximum value
interface BenchmarkConfig
public interface BenchmarkConfig{}
Description: Specifies an empty interface. It differentiates certain Configuration functions as performance-related configurations.
interface BenchmarkInputMarker
public interface BenchmarkInputMarker
Description: Detects BenchInputProvider<T>
when T
is not known.
interface Generator<T>
public interface Generator<T> {
func next(): T
}
Description: Generates a value of type T.
func next()
func next(): T
Description: Obtains the generated value of type T.
Returns:
- T: generated value of type T
interface Measurement
public interface Measurement {
func measure(f: () -> Unit): Float64
func measureIntermediate(): Float64 { 0.0 }
func toString(f: Float64): String
}
Description: Collects and analyzes various data during performance testing. The specific instance used by the performance test framework is specified by the measurement
parameter of the @Configure
macro.
func measure(() -> Unit)
func measure(f: () -> Unit): Float64
Description: Returns the data measuring the f
execution duration for statistical analysis.
Parameters:
- f: () -> Unit: a lambda function whose execution duration should be measured
Returns:
- Float64: measured data
func measureIntermediate()
func measureIntermediate(): Float64
Description: Measures the running time for statistical analysis.
Returns:
- Float64: measured data
func toString(Float64)
func toString(f: Float64): String
Description: Converts the floating-point representation of the measurement data into a string to be used in the performance test output.
Parameters:
- f: Float64: floating-point representation of the measurement data
Returns:
- String: string converted according to the format rule
interface Reporter
sealed interface Reporter <TReport, TReturn>
Description: Specifies a basic interface of a reporter.
interface TestClass
public interface TestClass {
func asTestSuite(): TestSuite
}
Description: Provides a method for creating a TestSuite.
func asTestSuite()
func asTestSuite(): TestSuite
Description: Provides a method for creating a TestSuite.
Returns:
- TestSuite: test suite object