use milliseconds

This commit is contained in:
Ethan Buchman
2016-01-27 00:40:07 -05:00
parent 85874a3765
commit bb52f23ff6
2 changed files with 5 additions and 4 deletions

View File

@@ -35,6 +35,7 @@ func (tn *TendermintNetwork) newBlockCallback(chainState *types.ChainState, val
// implements eventmeter.EventLatencyFunc
func (tn *TendermintNetwork) latencyCallback(chain *types.ChainState, val *types.ValidatorState) eventmeter.LatencyCallbackFunc {
return func(latency float64) {
latency = latency / 1000000.0 // ns to ms
oldLatency := val.UpdateLatency(latency)
chain.UpdateLatency(oldLatency, latency)
}

View File

@@ -83,8 +83,8 @@ type BlockchainStatus struct {
// Blockchain Info
Height int `json:"height"`
BlockchainSize int64 `json:"blockchain_size"`
MeanBlockTime float64 `json:"mean_block_time" wire:"unsafe"`
TxThroughput float64 `json:"tx_throughput" wire:"unsafe"`
MeanBlockTime float64 `json:"mean_block_time" wire:"unsafe"` // ms
TxThroughput float64 `json:"tx_throughput" wire:"unsafe"` // tx/s
blockTimeMeter metrics.Meter
txThroughputMeter metrics.Meter
@@ -93,7 +93,7 @@ type BlockchainStatus struct {
NumValidators int `json:"num_validators"`
ActiveValidators int `json:"active_validators"`
ActiveNodes int `json:"active_nodes"`
MeanLatency float64 `json:"mean_latency" wire:"unsafe"`
MeanLatency float64 `json:"mean_latency" wire:"unsafe"` // ms
Uptime float64 `json:"uptime" wire:"unsafe"`
// What else can we get / do we want?
@@ -114,7 +114,7 @@ func (s *BlockchainStatus) NewBlock(block *tmtypes.Block) {
s.Height = block.Header.Height
s.blockTimeMeter.Mark(1)
s.txThroughputMeter.Mark(int64(block.Header.NumTxs))
s.MeanBlockTime = 1 / s.blockTimeMeter.RateMean()
s.MeanBlockTime = (1 / s.blockTimeMeter.RateMean()) * 1000 // 1/s to ms
s.TxThroughput = s.txThroughputMeter.RateMean()
}
}