statistics

package
v1.1.60 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRoundDuration = errors.New("invalid round duration")

ErrInvalidRoundDuration signals that an invalid round duration was provided

View Source
var ErrInvalidShardId = errors.New("invalid shard id")

ErrInvalidShardId signals that the shard id is invalid

View Source
var ErrNilFileToWriteStats = errors.New("nil file to write statistics")

ErrNilFileToWriteStats signals that the file where statistics should be written is nil

View Source
var ErrNilInitialTPSBenchmarks = errors.New("nil initial TPS benchmarks")

ErrNilInitialTPSBenchmarks signals that nil TPS benchmarks have been provided

View Source
var ErrNilStatusHandler = errors.New("nil status handler")

ErrNilStatusHandler signals that a nil status handler has been provided

Functions

This section is empty.

Types

type ResourceMonitor

type ResourceMonitor struct {
	// contains filtered or unexported fields
}

ResourceMonitor outputs statistics about resources used by the binary

func NewResourceMonitor

func NewResourceMonitor() *ResourceMonitor

NewResourceMonitor creates a new ResourceMonitor instance

func (*ResourceMonitor) GenerateStatistics

func (rm *ResourceMonitor) GenerateStatistics(generalConfig *config.Config, pathManager storage.PathManagerHandler, shardId string) []interface{}

GenerateStatistics creates a new statistic string

func (*ResourceMonitor) SaveStatistics

func (rm *ResourceMonitor) SaveStatistics(generalConfig *config.Config, pathManager storage.PathManagerHandler, shardId string)

SaveStatistics generates and saves statistic data on the disk

type ShardStatistic

type ShardStatistic interface {
	ShardID() uint32
	AverageTPS() *big.Int
	AverageBlockTxCount() uint32
	CurrentBlockNonce() uint64
	LiveTPS() float64
	PeakTPS() float64
	LastBlockTxCount() uint32
	TotalProcessedTxCount() *big.Int
	IsInterfaceNil() bool
}

ShardStatistic is an interface used to calculate statistics for the network activity of a specific shard

type ShardStatistics

type ShardStatistics struct {
	// contains filtered or unexported fields
}

ShardStatistics will hold the tps statistics for each shard

func (*ShardStatistics) AverageBlockTxCount

func (ss *ShardStatistics) AverageBlockTxCount() uint32

AverageBlockTxCount returns an average transaction count for

func (*ShardStatistics) AverageTPS

func (ss *ShardStatistics) AverageTPS() *big.Int

AverageTPS returns an average tps for all processed blocks in a shard

func (*ShardStatistics) CurrentBlockNonce

func (ss *ShardStatistics) CurrentBlockNonce() uint64

CurrentBlockNonce returns the block nounce of the last processed block in a shard

func (*ShardStatistics) IsInterfaceNil

func (ss *ShardStatistics) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ShardStatistics) LastBlockTxCount

func (ss *ShardStatistics) LastBlockTxCount() uint32

LastBlockTxCount returns the number of transactions included in the last block

func (*ShardStatistics) LiveTPS

func (ss *ShardStatistics) LiveTPS() float64

LiveTPS returns tps for the last block

func (*ShardStatistics) PeakTPS

func (ss *ShardStatistics) PeakTPS() float64

PeakTPS returns peak tps for for all the blocks of the current shard

func (*ShardStatistics) ShardID

func (ss *ShardStatistics) ShardID() uint32

ShardID returns the shard id of the current statistic object

func (*ShardStatistics) TotalProcessedTxCount

func (ss *ShardStatistics) TotalProcessedTxCount() *big.Int

TotalProcessedTxCount returns the total number of processed transactions for this shard

type TPSBenchmark

type TPSBenchmark interface {
	Update(mb data.HeaderHandler)
	ActiveNodes() uint32
	RoundTime() uint64
	BlockNumber() uint64
	RoundNumber() uint64
	AverageBlockTxCount() *big.Int
	LastBlockTxCount() uint32
	TotalProcessedTxCount() *big.Int
	LiveTPS() float64
	PeakTPS() float64
	NrOfShards() uint32
	ShardStatistics() map[uint32]ShardStatistic
	ShardStatistic(shardID uint32) ShardStatistic
	IsInterfaceNil() bool
}

TPSBenchmark is an interface used to calculate statistics for the network activity

type TpsBenchmark

type TpsBenchmark struct {
	// contains filtered or unexported fields
}

TpsBenchmark will calculate statistics for the network activity

func NewTPSBenchmark

func NewTPSBenchmark(
	nrOfShards uint32,
	roundDuration uint64,
) (*TpsBenchmark, error)

NewTPSBenchmark instantiates a new object responsible with calculating statistics for each shard tps. nrOfShards represents the total number of shards, roundDuration is the duration for a round in seconds

func NewTPSBenchmarkWithInitialData added in v1.0.120

func NewTPSBenchmarkWithInitialData(
	appStatusHandler core.AppStatusHandler,
	initialTpsBenchmark *TpsPersistentData,
	nrOfShards uint32,
	roundDuration uint64,
) (*TpsBenchmark, error)

NewTPSBenchmarkWithInitialData instantiates a new object responsible with calculating statistics for each shard tps starting with initial data

func (*TpsBenchmark) ActiveNodes

func (s *TpsBenchmark) ActiveNodes() uint32

ActiveNodes returns the number of active nodes

func (*TpsBenchmark) AverageBlockTxCount

func (s *TpsBenchmark) AverageBlockTxCount() *big.Int

AverageBlockTxCount returns an average of the tx/block

func (*TpsBenchmark) BlockNumber

func (s *TpsBenchmark) BlockNumber() uint64

BlockNumber returns the last processed block number

func (*TpsBenchmark) IsInterfaceNil

func (s *TpsBenchmark) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*TpsBenchmark) LastBlockTxCount

func (s *TpsBenchmark) LastBlockTxCount() uint32

LastBlockTxCount returns the number of transactions processed in the last block

func (*TpsBenchmark) LiveTPS

func (s *TpsBenchmark) LiveTPS() float64

LiveTPS returns tps for the last block

func (*TpsBenchmark) NrOfShards

func (s *TpsBenchmark) NrOfShards() uint32

NrOfShards returns the number of shards

func (*TpsBenchmark) PeakTPS

func (s *TpsBenchmark) PeakTPS() float64

PeakTPS returns tps for the last block

func (*TpsBenchmark) RoundNumber

func (s *TpsBenchmark) RoundNumber() uint64

RoundNumber returns the round index for this benchmark object

func (*TpsBenchmark) RoundTime

func (s *TpsBenchmark) RoundTime() uint64

RoundTime returns the round duration in seconds

func (*TpsBenchmark) ShardStatistic

func (s *TpsBenchmark) ShardStatistic(shardID uint32) ShardStatistic

ShardStatistic returns the current statistical state for a given shard

func (*TpsBenchmark) ShardStatistics

func (s *TpsBenchmark) ShardStatistics() map[uint32]ShardStatistic

ShardStatistics returns the current statistical state for a given shard

func (*TpsBenchmark) TotalProcessedTxCount

func (s *TpsBenchmark) TotalProcessedTxCount() *big.Int

TotalProcessedTxCount returns the total number of processed transactions

func (*TpsBenchmark) Update

func (s *TpsBenchmark) Update(mblock data.HeaderHandler)

Update receives a metablock and updates all fields accordingly for each shard available in the meta block

type TpsPersistentData added in v1.0.120

type TpsPersistentData struct {
	BlockNumber           uint64
	RoundNumber           uint64
	PeakTPS               float64
	AverageBlockTxCount   *big.Int
	TotalProcessedTxCount *big.Int
	LastBlockTxCount      uint32
}

TpsPersistentData holds the tps benchmark data which is stored between node restarts

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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