Skip to content

Commit

Permalink
debug validator set allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Mar 11, 2024
1 parent c730af7 commit 8ce7851
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/coordinator/clients/consensus/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package consensus
import (
"context"
"fmt"
"runtime"
"sync"
"time"

Expand Down Expand Up @@ -38,6 +39,8 @@ type Pool struct {
rrLastIndexes map[ClientType]uint16
}

var debugValSetCounter uint64 = 1

func NewPool(ctx context.Context, config *PoolConfig, logger logrus.FieldLogger) (*Pool, error) {
var err error

Expand Down Expand Up @@ -83,6 +86,15 @@ func (pool *Pool) GetValidatorSet() map[phase0.ValidatorIndex]*v1.Validator {
return nil
}

valsetID := debugValSetCounter
debugValSetCounter++

fmt.Printf("valset alloc: %v\n", valsetID)

runtime.SetFinalizer(&valset, func(_ any) {
fmt.Printf("valset free: %v\n", valsetID)
})

return valset
})
}
Expand Down

0 comments on commit 8ce7851

Please sign in to comment.