@@ -11,6 +11,8 @@ import (
1111 "github.com/multiversx/mx-chain-go/common"
1212)
1313
14+ const conversionFactorToSeconds = 1e9
15+
1416const (
1517 statusSyncing = "currently syncing"
1618 statusSynchronized = "synchronized"
@@ -90,12 +92,15 @@ func (wr *WidgetsRender) setGrid() {
9092 colMemoryLoad := ui .NewCol (1.0 / 2 , wr .memoryLoad )
9193
9294 gridRight := ui .NewGrid ()
95+
96+ progressBarElementRatio := 3.0 / topHeight
97+ blockSectionHeightRatio := 1 - 4 * progressBarElementRatio
9398 gridRight .Set (
94- ui .NewRow (10.0 / 22 , wr .blockInfo ),
95- ui .NewRow (3.0 / 22 , colCpuLoad , colMemoryLoad ),
96- ui .NewRow (3.0 / 22 , wr .epochLoad ),
97- ui .NewRow (3.0 / 22 , wr .networkBytesInEpoch ),
98- ui .NewRow (3.0 / 22 , colNetworkSent , colNetworkRecv ),
99+ ui .NewRow (blockSectionHeightRatio , wr .blockInfo ),
100+ ui .NewRow (progressBarElementRatio , colCpuLoad , colMemoryLoad ),
101+ ui .NewRow (progressBarElementRatio , wr .epochLoad ),
102+ ui .NewRow (progressBarElementRatio , wr .networkBytesInEpoch ),
103+ ui .NewRow (progressBarElementRatio , colNetworkSent , colNetworkRecv ),
99104 )
100105
101106 gridBottom := ui .NewGrid ()
@@ -294,51 +299,70 @@ func computeRedundancyStr(redundancyLevel int64, redundancyIsMainActive string)
294299}
295300
296301func (wr * WidgetsRender ) prepareBlockInfo () {
297- // 7 rows and one column
298- numRows := 8
302+ // 8 rows and one column
303+ numRows := 9
299304 rows := make ([][]string , numRows )
300305
301306 currentBlockHeight := wr .presenter .GetNonce ()
302307 blockSize := wr .presenter .GetBlockSize ()
303308 rows [0 ] = []string {fmt .Sprintf ("Current block height: %d, size: %s" , currentBlockHeight , core .ConvertBytes (blockSize ))}
304309
305310 numTransactionInBlock := wr .presenter .GetNumTxInBlock ()
306- rows [1 ] = []string {fmt .Sprintf ("Num transactions in block: %d" , numTransactionInBlock )}
307-
308311 numMiniBlocks := wr .presenter .GetNumMiniBlocks ()
309- rows [2 ] = []string {fmt .Sprintf ("Num miniblocks in block: %d" , numMiniBlocks )}
312+ rows [1 ] = []string {fmt .Sprintf ("Num transactions in block: %d | Num miniblocks in block: %d" ,
313+ numTransactionInBlock ,
314+ numMiniBlocks ,
315+ )}
310316
311317 currentBlockHash := wr .presenter .GetCurrentBlockHash ()
312- rows [3 ] = []string {fmt .Sprintf ("Current block hash: %s" , currentBlockHash )}
318+ rows [2 ] = []string {fmt .Sprintf ("Current block hash: %s" , currentBlockHash )}
313319
314320 crossCheckBlockHeight := wr .presenter .GetCrossCheckBlockHeight ()
315- rows [4 ] = []string {fmt .Sprintf ("Cross check: %s" , crossCheckBlockHeight )}
321+ rows [3 ] = []string {fmt .Sprintf ("Cross check: %s" , crossCheckBlockHeight )}
316322
317323 shardId := wr .presenter .GetShardId ()
318324 if shardId != uint64 (core .MetachainShardId ) {
319325 highestFinalBlock := wr .presenter .GetHighestFinalBlock ()
320- rows [4 ][0 ] += fmt .Sprintf (", final nonce: %d" , highestFinalBlock )
326+ rows [3 ][0 ] += fmt .Sprintf (", final nonce: %d" , highestFinalBlock )
321327 }
322328
323329 consensusState := wr .presenter .GetConsensusState ()
324- rows [5 ] = []string {fmt .Sprintf ("Consensus state: %s" , consensusState )}
330+ rows [4 ] = []string {fmt .Sprintf ("Consensus state: %s" , consensusState )}
325331
326332 syncStatus := wr .presenter .GetIsSyncing ()
327333 switch syncStatus {
328334 case 1 :
329- rows [6 ] = []string {"Consensus round state: N/A (syncing)" }
335+ rows [5 ] = []string {"Consensus round state: N/A (syncing)" }
330336 case 0 :
331337 instanceType := wr .presenter .GetNodeType ()
332338 if instanceType == string (core .NodeTypeObserver ) {
333- rows [6 ] = []string {fmt .Sprintf ("Consensus round state: N/A (%s)" , string (core .NodeTypeObserver ))}
339+ rows [5 ] = []string {fmt .Sprintf ("Consensus round state: N/A (%s)" , string (core .NodeTypeObserver ))}
334340 } else {
335341 consensusRoundState := wr .presenter .GetConsensusRoundState ()
336- rows [6 ] = []string {fmt .Sprintf ("Consensus round state: %s" , consensusRoundState )}
342+ rows [5 ] = []string {fmt .Sprintf ("Consensus round state: %s" , consensusRoundState )}
337343 }
338344 }
339345
340346 currentRoundTimestamp := wr .presenter .GetCurrentRoundTimestamp ()
341- rows [7 ] = []string {fmt .Sprintf ("Current round timestamp: %d" , currentRoundTimestamp )}
347+ rows [8 ] = []string {fmt .Sprintf ("Current round timestamp: %d" , currentRoundTimestamp )}
348+
349+ durationStartRoundToSentOrReceivedBlock := float64 (wr .presenter .GetDurationProposedBlockReceivedOrSentFromRoundStart ()) / conversionFactorToSeconds
350+ durationSentOrReceivedBlockToReceivedSignatures := float64 (wr .presenter .GetDurationProofReceivedFromProposedBlockReceivedOrSent ()) / conversionFactorToSeconds
351+
352+ rows [6 ] = []string {
353+ fmt .Sprintf ("Received proposed block: %.6f sec | Received signatures: %.6f sec" ,
354+ durationStartRoundToSentOrReceivedBlock ,
355+ durationSentOrReceivedBlockToReceivedSignatures ),
356+ }
357+
358+ durationStartRoundToSentOrReceivedBlock = float64 (wr .presenter .GetAvgDurationProposedBlockReceivedOrSentFromRoundStart ()) / conversionFactorToSeconds
359+ durationSentOrReceivedBlockToReceivedSignatures = float64 (wr .presenter .GetAvgDurationProofReceivedFromProposedBlockReceivedOrSent ()) / conversionFactorToSeconds
360+
361+ rows [7 ] = []string {
362+ fmt .Sprintf ("Avg Received proposed block: %.6f sec | Avg Received signatures: %.6f sec" ,
363+ durationStartRoundToSentOrReceivedBlock ,
364+ durationSentOrReceivedBlockToReceivedSignatures ),
365+ }
342366
343367 wr .blockInfo .Title = "Block info:"
344368 wr .blockInfo .RowSeparator = false
0 commit comments