Skip to content
Snippets Groups Projects
Select Git revision
  • 02794bd12d6ca11d50c5b39c363af10878d96b9c
  • without_tipselection default
  • develop protected
  • fix/grafana-local-dashboard
  • wasp
  • fix/dashboard-explorer-freeze
  • master
  • feat/timerqueue
  • test/sync_debug_and_650
  • feat/sync_revamp_inv
  • wip/sync
  • tool/db-recovery
  • portcheck/fix
  • fix/synchronization
  • feat/new-dashboard-analysis
  • feat/refactored-analysis-dashboard
  • feat/new-analysis-dashboard
  • test/demo-prometheus-fpc
  • prometheus_metrics
  • wip/analysis-server
  • merge/fpc-test-value-transfer
  • v0.2.2
  • v0.2.1
  • v0.2.0
  • v0.1.3
  • v0.1.2
  • v0.1.1
  • v0.1.0
28 results

tps.go

Blame
  • tps.go 920 B
    package metrics
    
    import (
    	"sync/atomic"
    )
    
    // public api method to proactively retrieve the received TPS value
    func GetReceivedTPS() uint64 {
    	return atomic.LoadUint64(&measuredReceivedTPS)
    }
    
    // counter for the received TPS
    var tpsReceivedSinceLastMeasurement uint64
    
    // measured value of the received TPS
    var measuredReceivedTPS uint64
    
    // increases the received TPS counter
    func increaseReceivedTPSCounter() {
    	atomic.AddUint64(&tpsReceivedSinceLastMeasurement, 1)
    }
    
    // measures the received TPS value
    func measureReceivedTPS() {
    	// sample the current counter value into a measured TPS value
    	sampledTPS := atomic.LoadUint64(&tpsReceivedSinceLastMeasurement)
    
    	// store the measured value
    	atomic.StoreUint64(&measuredReceivedTPS, sampledTPS)
    
    	// reset the counter
    	atomic.StoreUint64(&tpsReceivedSinceLastMeasurement, 0)
    
    	// trigger events for outside listeners
    	Events.ReceivedTPSUpdated.Trigger(sampledTPS)
    }