benchmarks

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ThresholdEnoughComputingPower = 31 * time.Second

ThresholdEnoughComputingPower represents the threshold considered when deciding if a Node Under Test (NUT) is considered having (or not) enough compute capability when executing SC calls. if the result.TotalDuration exceeds this const, the NUT is considered less powerful (the NUT needed more time to process same amount of work). The value is hardcoded and was decided through testing.

Variables

View Source
var ErrEmptyBenchmarksSlice = errors.New("empty benchmarks slice provided")

ErrEmptyBenchmarksSlice signals that the provided benchmarks slice was empty

View Source
var ErrFileDoesNotExist = errors.New("file does not exist")

ErrFileDoesNotExist signals that the required file does not exist

View Source
var ErrNilBenchmark = errors.New("nil benchmark")

ErrNilBenchmark signals that a nil benchmark was provided

Functions

func NewCoordinator

func NewCoordinator(benchmarks []BenchmarkRunner) (*coordinator, error)

NewCoordinator will create a coordinator used to launch all provided benchmarks

func NewDelegationBenchmark

func NewDelegationBenchmark(arg ArgDelegationBenchmark) *delegationBenchmark

NewDelegationBenchmark creates a new benchmark based on delegation SC execution through Wasm VM

func NewErc20Benchmark

func NewErc20Benchmark(arg ArgErc20Benchmark) *erc20Benchmark

NewErc20Benchmark creates a new benchmark based on erc20 SC execution through Wasm VM

func NewWasmBenchmark

func NewWasmBenchmark(arg ArgWasmBenchmark) *wasmBenchmark

NewWasmBenchmark creates a new benchmark based on SC execution through wasm VM

Types

type ArgDelegationBenchmark

type ArgDelegationBenchmark struct {
	Name               string
	ScFilename         string
	NumRuns            int
	NumBatches         uint32
	NumTxPerBatch      uint32
	NumQueriesPerBatch uint32
}

ArgDelegationBenchmark is the delegation type benchmark argument used in constructor

type ArgErc20Benchmark

type ArgErc20Benchmark struct {
	Name               string
	ScFilename         string
	Function           string
	NumRuns            int
	NumTransfersPerRun int
}

ArgErc20Benchmark is the erc20 type benchmark argument used in constructor

type ArgWasmBenchmark

type ArgWasmBenchmark struct {
	Name         string
	ScFilename   string
	TestingValue uint64
	Function     string
	Arguments    [][]byte
	NumRuns      int
}

ArgWasmBenchmark is the wasm type benchmark argument used in constructor

type BenchmarkRunner

type BenchmarkRunner interface {
	Run() (time.Duration, error)
	Name() string
	IsInterfaceNil() bool
}

BenchmarkRunner defines a benchmark test able to measure in some way the host

type SingleResult

type SingleResult struct {
	time.Duration
	Name  string
	Error error
}

SingleResult contains the output data after a benchmark run

type TestResults

type TestResults struct {
	TotalDuration        time.Duration
	Error                error
	Results              []SingleResult
	EnoughComputingPower bool
}

TestResults represents the output structure containing the test results data

func (*TestResults) ToDisplayTable

func (tr *TestResults) ToDisplayTable() string

ToDisplayTable will output the contained data as an ASCII table

func (*TestResults) ToStrings

func (tr *TestResults) ToStrings() [][]string

ToStrings will return the contained data as strings (to be easily written, e.g. in a file)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL