Skip to content

Commit

Permalink
added block read time stats
Browse files Browse the repository at this point in the history
  • Loading branch information
billettc committed Sep 14, 2023
1 parent 0172c45 commit 3bea2a0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions accountresolver/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type stats struct {
totalExtendDuration time.Duration
totalBlockProcessingDuration time.Duration
totalBlockHandlingDuration time.Duration
totalBlockReadingDuration time.Duration
}

func (s *stats) log(logger *zap.Logger) {
Expand Down Expand Up @@ -59,6 +60,7 @@ func (s *stats) log(logger *zap.Logger) {
zap.String("total_lookup_duration", durafmt.Parse(s.totalLookupDuration).String()),
zap.String("total_extend_duration", durafmt.Parse(s.totalExtendDuration).String()),
zap.String("total_duration", durafmt.Parse(time.Since(s.startProcessing)).String()),
zap.String("total_block_reading_duration", durafmt.Parse(s.totalBlockReadingDuration).String()),
zap.String("average_block_handling_duration", durafmt.Parse(s.totalBlockHandlingDuration/time.Duration(s.totalBlockCount)).String()),
zap.String("average_block_processing_duration", durafmt.Parse(s.totalBlockProcessingDuration/time.Duration(s.totalBlockCount)).String()),
zap.String("average_transaction_processing_duration", durafmt.Parse(s.totalTransactionProcessingDuration/time.Duration(s.transactionCount)).String()),
Expand Down Expand Up @@ -144,6 +146,7 @@ func (p *Processor) processMergeBlocksFiles(ctx context.Context, filename string
blockChan := make(chan *pbsol.Block, 100)

go func() {
start := time.Now()
for {
block, err := blockReader.Read()
if err != nil {
Expand All @@ -163,6 +166,7 @@ func (p *Processor) processMergeBlocksFiles(ctx context.Context, filename string

blockChan <- blk
}
p.stats.totalBlockReadingDuration += time.Since(start)
}()

nailer := dhammer.NewNailer(50, func(ctx context.Context, blk *pbsol.Block) (*bstream.Block, error) {
Expand Down

0 comments on commit 3bea2a0

Please sign in to comment.