Merge pull request #22 from simple-rules/ricl-tps

updated tps starttime location
pull/27/head
7z7 6 years ago committed by GitHub
commit 968188fb25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      consensus/consensus_leader.go

@ -23,7 +23,8 @@ func (consensus *Consensus) WaitForNewBlock(blockChannel chan blockchain.Block)
for { // keep waiting for new blocks
newBlock := <-blockChannel
// TODO: think about potential race condition
consensus.Log.Debug("STARTING CONSENSUS", "consensus", consensus)
startTime = time.Now()
consensus.Log.Info("STARTING CONSENSUS", "consensus", consensus, "startTime", startTime)
for consensus.state == FINISHED {
time.Sleep(500 * time.Millisecond)
consensus.startConsensus(&newBlock)
@ -62,7 +63,6 @@ func (consensus *Consensus) ProcessMessageLeader(message []byte) {
// Handler for message which triggers consensus process
func (consensus *Consensus) processStartConsensusMessage(payload []byte) {
startTime = time.Now()
tx := blockchain.NewCoinbaseTX("x", "y", 0)
consensus.startConsensus(blockchain.NewGenesisBlock(tx, 0))
}
@ -329,7 +329,12 @@ func (consensus *Consensus) processResponseMessage(payload []byte) {
endTime := time.Now()
timeElapsed := endTime.Sub(startTime)
numOfTxs := blockHeaderObj.NumTransactions
consensus.Log.Info("TPS Report", "numOfTXs", numOfTxs, "timeElapsed", timeElapsed, "TPS", float64(numOfTxs)/timeElapsed.Seconds())
consensus.Log.Info("TPS Report",
"numOfTXs", numOfTxs,
"startTime", startTime,
"endTime", endTime,
"timeElapsed", timeElapsed,
"TPS", float64(numOfTxs)/timeElapsed.Seconds())
var m runtime.MemStats
runtime.ReadMemStats(&m)

Loading…
Cancel
Save