return extra duration info for stats

This commit is contained in:
cryptonote-social 2020-08-16 12:35:13 -07:00
parent 1803122a24
commit a97298f709
2 changed files with 6 additions and 6 deletions

View File

@ -433,7 +433,7 @@ func GetMiningState() *GetMiningStateResponse {
if as > 0 {
isMining = true
}
s, secondsSinceReset := stats.GetSnapshot(isMining)
s, secondsSinceReset, _ := stats.GetSnapshot(isMining)
if secondsSinceReset > 10.0 && s.RecentHashrate < -1.0 {
// We have enough of a window to compute an accurate recent hashrate, so
// force the mining loop to do so for the next call.
@ -449,7 +449,7 @@ func GetMiningState() *GetMiningStateResponse {
}
func updatePoolStats(isMining bool) {
s, _ := stats.GetSnapshot(isMining)
s, _, _ := stats.GetSnapshot(isMining)
configMutex.Lock()
uname := plArgs.Username
configMutex.Unlock()
@ -473,8 +473,8 @@ func pokeJobDispatcher(pokeMsg int) {
}
func printStats(isMining bool) {
s, sec := stats.GetSnapshot(isMining)
crylog.Info("Recent hashrate computation window (seconds):", sec)
s, _, window := stats.GetSnapshot(isMining)
crylog.Info("Recent hashrate computation window (seconds):", window)
crylog.Info("=====================================")
//crylog.Info("Shares [accepted:rejected]:", s.SharesAccepted, ":", s.SharesRejected)
//crylog.Info("Hashes [client:pool]:", s.ClientSideHashes, ":", s.PoolSideHashes)

View File

@ -95,7 +95,7 @@ type Snapshot struct {
SecondsOld int // how many seconds out of date the pool stats are
}
func GetSnapshot(isMining bool) (s *Snapshot, secondsSinceReset float64) {
func GetSnapshot(isMining bool) (s *Snapshot, secondsSinceReset float64, secondsRecentWindow float64) {
mutex.Lock()
defer mutex.Unlock()
r := &Snapshot{}
@ -144,7 +144,7 @@ func GetSnapshot(isMining bool) (s *Snapshot, secondsSinceReset float64) {
r.TimeToReward = timeToReward
}
r.SecondsOld = int(time.Now().Sub(lastPoolUpdateTime).Seconds())
return r, time.Now().Sub(lastResetTime).Seconds()
return r, time.Now().Sub(lastResetTime).Seconds(), elapsedRecent
}
func RefreshPoolStats(username string) error {