stat

package
v0.0.0-...-c598841 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: BSD-4-Clause, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const STATRECORDER_FILE string = "stat_recorder"

Variables

View Source
var BaseTimePeriod int64 = 60

Functions

func TimeToPeriod

func TimeToPeriod(t time.Time) uint64

Types

type FarmData

type FarmData struct {
	Datas map[uint64]*PeriodFarmData
	*OverallFarmData
}

func NewFarmData

func NewFarmData() *FarmData

func (*FarmData) AddClaim

func (fd *FarmData) AddClaim(status string, claim smartpool.Claim, t time.Time)

func (*FarmData) AddHashrate

func (fd *FarmData) AddHashrate(rig smartpool.Rig, hashrate hexutil.Uint64, id common.Hash, t time.Time)

func (*FarmData) AddShare

func (fd *FarmData) AddShare(rig smartpool.Rig, status string, share smartpool.Share, t time.Time)

func (*FarmData) ShareRestored

func (fd *FarmData) ShareRestored(noShares uint64)

type OverallFarmData

type OverallFarmData struct {
	LastMinedShare           time.Time       `json:"last_mined_share"`
	LastValidShare           time.Time       `json:"last_valid_share"`
	LastRejectedShare        time.Time       `json:"last_rejected_share"`
	LastBlock                time.Time       `json:"last_block"`
	MinedShare               uint64          `json:"mined_share"`
	ValidShare               uint64          `json:"valid_share"`
	TotalValidDifficulty     *big.Int        `json:"-"`
	AverageShareDifficulty   *big.Int        `json:"average_share_difficulty"`
	RejectedShare            uint64          `json:"rejected_share"`
	LastSubmittedClaim       time.Time       `json:"last_submitted_claim"`
	LastAcceptedClaim        time.Time       `json:"last_accepted_claim"`
	LastRejectedClaim        time.Time       `json:"last_rejected_claim"`
	SubmittedClaim           uint64          `json:"total_submitted_claim"`
	AcceptedClaim            uint64          `json:"total_accepted_claim"`
	RejectedClaim            uint64          `json:"total_rejected_claim"`
	TotalHashrate            *big.Int        `json:"-"`
	NoHashrateSubmission     uint64          `json:"-"`
	AverageReportedHashrate  *big.Int        `json:"reported_hashrate"`
	AverageEffectiveHashrate *big.Int        `json:"effective_hashrate"`
	Rigs                     map[string]bool `json:"rigs"`
	BlockFound               uint64          `json:"total_block_found"`
	// A share is pending when it is not included in any claim
	PendingShare uint64 `json:"pending_share"`
	// A share is considered as abandoned when the claim it belongs to was
	// rejected by the contract or it is discarded while being restored
	// from last running session because of configuration changes
	AbandonedShare      uint64    `json:"abandoned_share"`
	BeingValidatedShare uint64    `json:"being_validated_share"`
	VerifiedShare       uint64    `json:"verified_share"`
	StartTime           time.Time `json:"start_time"`
}

type OverallRigData

type OverallRigData struct {
	LastMinedShare           time.Time `json:"last_mined_share"`
	LastValidShare           time.Time `json:"last_valid_share"`
	LastRejectedShare        time.Time `json:"last_rejected_share"`
	LastBlock                time.Time `json:"last_block"`
	MinedShare               uint64    `json:"total_submitted_share"`
	ValidShare               uint64    `json:"total_accepted_share"`
	TotalValidDifficulty     *big.Int  `json:"total_accepted_difficulty"`
	AverageShareDifficulty   *big.Int  `json:"average_share_difficulty"`
	RejectedShare            uint64    `json:"total_rejected_share"`
	TotalHashrate            *big.Int  `json:"total_hashrate"`
	NoHashrateSubmission     uint64    `json:"no_hashrate_submission"`
	AverageReportedHashrate  *big.Int  `json:"average_reported_hashrate"`
	AverageEffectiveHashrate *big.Int  `json:"average_effective_hashrate"`
	BlockFound               uint64    `json:"total_block_found"`
	StartTime                time.Time `json:"start_time"`
}

type PeriodFarmData

type PeriodFarmData struct {
	MinedShare               uint64          `json:"mined_share"`
	ValidShare               uint64          `json:"valid_share"`
	TotalValidDifficulty     *big.Int        `json:"-"`
	AverageShareDifficulty   *big.Int        `json:"average_share_difficulty"`
	RejectedShare            uint64          `json:"rejected_share"`
	SubmittedClaim           uint64          `json:"submitted_claim"`
	AcceptedClaim            uint64          `json:"accepted_claim"`
	RejectedClaim            uint64          `json:"rejected_claim"`
	TotalHashrate            *big.Int        `json:"-"`
	NoHashrateSubmission     uint64          `json:"-"`
	AverageReportedHashrate  *big.Int        `json:"reported_hashrate"`
	AverageEffectiveHashrate *big.Int        `json:"effective_hashrate"`
	Rigs                     map[string]bool `json:"rigs"`
	BlockFound               uint64          `json:"block_found"`
	TimePeriod               uint64          `json:"time_period"`
	StartTime                time.Time       `json:"start_time"`
}

func NewPeriodFarmData

func NewPeriodFarmData(timePeriod uint64) *PeriodFarmData

type PeriodRigData

type PeriodRigData struct {
	MinedShare               uint64    `json:"mined_share"`
	ValidShare               uint64    `json:"valid_share"`
	TotalValidDifficulty     *big.Int  `json:"-"`
	AverageShareDifficulty   *big.Int  `json:"average_share_difficulty"`
	RejectedShare            uint64    `json:"rejected_share"`
	TotalHashrate            *big.Int  `json:"-"`
	NoHashrateSubmission     uint64    `json:"-"`
	AverageReportedHashrate  *big.Int  `json:"reported_hashrate"`
	AverageEffectiveHashrate *big.Int  `json:"effective_hashrate"`
	BlockFound               uint64    `json:"block_found"`
	TimePeriod               uint64    `json:"time_period"`
	StartTime                time.Time `json:"start_time"`
}

func NewPeriodRigData

func NewPeriodRigData(timePeriod uint64) *PeriodRigData

type RigData

type RigData struct {
	Datas map[uint64]*PeriodRigData
	*OverallRigData
}

func NewRigData

func NewRigData() *RigData

func (*RigData) AddHashrate

func (rd *RigData) AddHashrate(hashrate hexutil.Uint64, id common.Hash, t time.Time)

func (*RigData) AddShare

func (rd *RigData) AddShare(status string, share smartpool.Share, t time.Time)

type StatRecorder

type StatRecorder struct {
	RigDatas map[string]*RigData
	FarmData *FarmData
	// contains filtered or unexported fields
}

func NewStatRecorder

func NewStatRecorder(storage smartpool.PersistentStorage) *StatRecorder

func (*StatRecorder) FarmStat

func (sr *StatRecorder) FarmStat(start uint64, end uint64) interface{}

func (*StatRecorder) OverallFarmStat

func (sr *StatRecorder) OverallFarmStat() interface{}

func (*StatRecorder) OverallRigStat

func (sr *StatRecorder) OverallRigStat(rig smartpool.Rig) interface{}

func (*StatRecorder) Persist

func (sr *StatRecorder) Persist(storage smartpool.PersistentStorage) error

func (*StatRecorder) RecordClaim

func (sr *StatRecorder) RecordClaim(status string, claim smartpool.Claim)

func (*StatRecorder) RecordHashrate

func (sr *StatRecorder) RecordHashrate(hashrate hexutil.Uint64, id common.Hash, rig smartpool.Rig)

func (*StatRecorder) RecordShare

func (sr *StatRecorder) RecordShare(status string, share smartpool.Share, rig smartpool.Rig)

func (*StatRecorder) RigStat

func (sr *StatRecorder) RigStat(rig smartpool.Rig, start, end uint64) interface{}

func (*StatRecorder) ShareRestored

func (sr *StatRecorder) ShareRestored(noShares uint64)

Jump to

Keyboard shortcuts

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