Documentation ¶
Index ¶
- Variables
- type ResourceMonitor
- type ShardStatistic
- type ShardStatistics
- func (ss *ShardStatistics) AverageBlockTxCount() uint32
- func (ss *ShardStatistics) AverageTPS() *big.Int
- func (ss *ShardStatistics) CurrentBlockNonce() uint64
- func (ss *ShardStatistics) IsInterfaceNil() bool
- func (ss *ShardStatistics) LastBlockTxCount() uint32
- func (ss *ShardStatistics) LiveTPS() float64
- func (ss *ShardStatistics) PeakTPS() float64
- func (ss *ShardStatistics) ShardID() uint32
- func (ss *ShardStatistics) TotalProcessedTxCount() *big.Int
- type TPSBenchmark
- type TpsBenchmark
- func (s *TpsBenchmark) ActiveNodes() uint32
- func (s *TpsBenchmark) AverageBlockTxCount() *big.Int
- func (s *TpsBenchmark) BlockNumber() uint64
- func (s *TpsBenchmark) IsInterfaceNil() bool
- func (s *TpsBenchmark) LastBlockTxCount() uint32
- func (s *TpsBenchmark) LiveTPS() float64
- func (s *TpsBenchmark) NrOfShards() uint32
- func (s *TpsBenchmark) PeakTPS() float64
- func (s *TpsBenchmark) RoundNumber() uint64
- func (s *TpsBenchmark) RoundTime() uint64
- func (s *TpsBenchmark) ShardStatistic(shardID uint32) ShardStatistic
- func (s *TpsBenchmark) ShardStatistics() map[uint32]ShardStatistic
- func (s *TpsBenchmark) TotalProcessedTxCount() *big.Int
- func (s *TpsBenchmark) Update(mblock data.HeaderHandler)
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidRoundDuration = errors.New("invalid round duration")
ErrInvalidRoundDuration signals that an invalid round duration was provided
var ErrInvalidShardId = errors.New("invalid shard id")
ErrInvalidShardId signals that the shard id is invalid
var ErrNilFileToWriteStats = errors.New("nil file to write statistics")
ErrNilFileToWriteStats signals that the file where statistics should be written is nil
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(file *os.File) (*ResourceMonitor, error)
NewResourceMonitor creates a new ResourceMonitor instance
func (*ResourceMonitor) Close ¶
func (rm *ResourceMonitor) Close() error
Close closes the file used for statistics
func (*ResourceMonitor) GenerateStatistics ¶
func (rm *ResourceMonitor) GenerateStatistics(generalConfig *config.Config, pathManager storage.PathManagerHandler, shardId string) string
GenerateStatistics creates a new statistic string
func (*ResourceMonitor) SaveStatistics ¶
func (rm *ResourceMonitor) SaveStatistics(generalConfig *config.Config, pathManager storage.PathManagerHandler, shardId string) error
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 (*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