Skip to content

Commit

Permalink
add profile for open/close pebble iterator (#6964)
Browse files Browse the repository at this point in the history
  • Loading branch information
luluz66 authored Jun 28, 2024
1 parent af052a2 commit 0e46543
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion enterprise/server/util/pebble/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"runtime"
"runtime/pprof"
"sync"
"time"

Expand All @@ -24,6 +25,8 @@ var (
warnAboutLeaks = flag.Bool("cache.pebble.warn_about_leaks", true, "If set, warn about leaked DB handles")
)

var pebbleIterProfile = pprof.NewProfile("pebble_open_iter")

var NoSync = pebble.NoSync
var Sync = pebble.Sync
var ErrNotFound = pebble.ErrNotFound
Expand Down Expand Up @@ -187,6 +190,7 @@ type instrumentedIter struct {
}

func (i *instrumentedIter) Close() error {
pebbleIterProfile.Remove(i)
return i.iter.Close()
}

Expand Down Expand Up @@ -393,7 +397,9 @@ func (idb *instrumentedDB) NewIter(o *pebble.IterOptions) (Iterator, error) {
if err != nil {
return nil, err
}
return &instrumentedIter{idb, iter}, nil
res := &instrumentedIter{idb, iter}
pebbleIterProfile.Add(res, 1)
return res, nil
}

func (idb *instrumentedDB) NewBatch() Batch {
Expand Down

0 comments on commit 0e46543

Please sign in to comment.