Interfaces

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. 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 types:

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{
    func batchSize(b: Int64): Unit
    func batchSize(x: Range<Int64>): Unit
    func warmup(x: Int64): Unit
    func warmup(x: Duration): Unit
    func minDuration(x: Duration): Unit
    func explicitGC(x: ExplicitGcType): Unit
    func minBatches(x: Int64): Unit

    mut prop conversionTable: MeasurementUnitTable
    mut prop measurementName: String
}

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 {
    prop conversionTable: MeasurementUnitTable
    prop name: String
    prop textDescription: String
    func setup(): Unit
    func measure(): Float64
}

Description: Specifies how to measure data during the performance test and how to display data in the report. The instance that implements the interface can be passed as an attribute of the @Measure macro.

prop conversionTable

prop conversionTable: MeasurementUnitTable

Description: Builds the representation of measurement values in the performance test report. It includes the boundary pair that contains the measurement unit. The most appropriate unit is used based on the value boundary. For reports in CSV format, the lower limit is always selected to simplify result processing. The default value is [(1.0, "")].

Type: MeasurementUnitTable

prop name

prop name: String

Description: Specifies the only name displayed for the current Measurement type. This helps to distinguish between different measurement types in the report table. The default value is Measurement.

Type: String

prop textDescription

prop textDescription: String

Description: Specifies the simple text describing this measurement that will be displayed in some reports.

Type: String

func measure()

func measure(): Float64

Description: Measures the running time for statistical analysis.

Returns:

func setup()

func setup()

Description: Specifies the initialization routine of this measurement, which is called before each benchmark step.

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: