Documentation ¶
Index ¶
- Constants
- Variables
- func NewLinear(name string, min, max uint32) (*linear, error)
- func RunDispatchCall(b *testing.B, outputPath string, testFn func(i *Instance), ...)
- func RunHook(b *testing.B, hookName string, setupFn func(storage *runtime.Storage), ...) benchmarkingtypes.BenchmarkResult
- type BlockBuilder
- type Instance
- func (i *Instance) BuildGenesisConfig() error
- func (i *Instance) ExecuteExtrinsic(callName string, origin primitives.RawOrigin, args ...interface{}) error
- func (i *Instance) GetAccountInfo(publicKey []byte) (gossamertypes.AccountInfo, error)
- func (i *Instance) InitializeBlock(blockNumber uint, timestamp uint64) error
- func (i *Instance) Metadata() *ctypes.Metadata
- func (i *Instance) SetAccountInfo(publicKey []byte, accountInfo gossamertypes.AccountInfo) error
- func (i *Instance) Storage() *runtime.Storage
- type StatsResult
Constants ¶
const RuntimeWasmBinary = "runtime-benchmarks.wasm"
Variables ¶
var Config = initBenchmarkingConfig()
cmd flags and other options related to benchmarking
Functions ¶
func NewLinear ¶
Used by benchmark tests to specify that a benchmarking variable is linear over some specified range, i.e. `NewLinear("a", 0, 1000)` means that the corresponding variable is allowed to range from `0` to `1000`, inclusive and generated weight file will accept arg named "a"
func RunDispatchCall ¶
func RunDispatchCall(b *testing.B, outputPath string, testFn func(i *Instance), components ...*linear)
Executes a benchmark test. b is a go benchmark instance which must be provided by the calling test. outputPath is the path where weight file will be generated. testFn is a closure function that defines the test. It accepts a benchmarking instance param which is used to setup storage and run extrinsics. components is a registry for linear components variables which testFn may use.
Types ¶
type BlockBuilder ¶
type BlockBuilder struct {
// contains filtered or unexported fields
}
func NewBlockBuilder ¶
func NewBlockBuilder(instance *Instance, inherentData []byte) BlockBuilder
func (*BlockBuilder) AddExtrinsic ¶
func (bb *BlockBuilder) AddExtrinsic(extrinsic []byte) (bool, error)
AddExtrinsic adds an extrinsic to the simulated block. Returns true if the extrinsics application has reached the ExhaustsResource to the simulated block.
func (*BlockBuilder) ApplyInherentExtrinsics ¶
func (bb *BlockBuilder) ApplyInherentExtrinsics() error
ApplyInherentExtrinsics converts the inherent data to extrinsics and adds them to the simulated block.
func (*BlockBuilder) FinishSimulation ¶
func (bb *BlockBuilder) FinishSimulation() (gossamertypes.Block, error)
FinishSimulation finalizes the block and returns it. Restores the DB to the initial snapshot from StartSimulation
func (*BlockBuilder) StartSimulation ¶
func (bb *BlockBuilder) StartSimulation(blockNumber uint) error
StartSimulation begins a block simulation by creating a snapshot of the DB and initialising the block.
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
func (*Instance) BuildGenesisConfig ¶
func (*Instance) ExecuteExtrinsic ¶
func (i *Instance) ExecuteExtrinsic(callName string, origin primitives.RawOrigin, args ...interface{}) error
Executes extrinsic with provided call name. Accepts optional param signer, which if provided is used to sign the extrinsic. Additionally the method appends the benchmark result to instance.benchmarkResults
func (*Instance) GetAccountInfo ¶
func (i *Instance) GetAccountInfo(publicKey []byte) (gossamertypes.AccountInfo, error)
func (*Instance) InitializeBlock ¶
func (*Instance) SetAccountInfo ¶
func (i *Instance) SetAccountInfo(publicKey []byte, accountInfo gossamertypes.AccountInfo) error
Sets the specified account info for the specified public key
type StatsResult ¶
type StatsResult struct { Sum float64 Min float64 Max float64 Mean float64 Median float64 Stddev float64 P99 float64 P95 float64 P75 float64 }
func NewStatsResult ¶
func NewStatsResult(input []float64) (StatsResult, error)
func (StatsResult) String ¶
func (s StatsResult) String() string