Skip to content

Commit

Permalink
add latency log for index
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenlanders committed Mar 25, 2024
1 parent 2a382f8 commit 25546bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/state/indexer/tx/kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"regexp"
"strconv"
"strings"
"time"

"github.com/gogo/protobuf/proto"
"github.com/google/orderedcode"
Expand Down Expand Up @@ -65,6 +66,7 @@ func (txi *TxIndex) Get(hash []byte) (*abci.TxResult, error) {
// respective attribute's key delimited by a "." (eg. "account.number").
// Any event with an empty type is not indexed.
func (txi *TxIndex) Index(results []*abci.TxResult) error {
startTime := time.Now()
b := txi.store.NewBatch()
defer b.Close()

Expand Down Expand Up @@ -94,7 +96,10 @@ func (txi *TxIndex) Index(results []*abci.TxResult) error {
}
}

return b.WriteSync()
fmt.Printf("PERF TxIndex.Index latency=%dms, txs=%d\n", time.Since(startTime).Milliseconds(), len(results))
err := b.WriteSync()

return err
}

func (txi *TxIndex) indexEvents(result *abci.TxResult, hash []byte, store dbm.Batch) error {
Expand Down

0 comments on commit 25546bd

Please sign in to comment.