Skip to content

Commit

Permalink
Improve BufferList debug dump
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalif committed Mar 20, 2024
1 parent 0ca77ff commit 2366e87
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion internal/buffer_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ func (l *BufferList) Ascend(offset uint64, iter func(end uint64, b *FileBuffer)
ascendChange(&l.at, offset, iter)
}

func (l *BufferList) Count() int {
return l.at.Len()
}

func (l *BufferList) EvictFromMemory(buf *FileBuffer) (allocated int64, deleted bool) {
// Release memory
buf.ptr.refs--
Expand Down Expand Up @@ -642,7 +646,15 @@ func (l *BufferList) Dump(offset, size uint64) {
if b.offset >= offset+size {
return false
}
fmt.Printf("%x-%x s%v l%v z%v d%v\n", b.offset, b.offset+b.length, b.state, b.loading, b.zero, b.dirtyID)
l := 0
if b.loading {
l = 1
}
z := 0
if b.zero {
z = 1
}
fmt.Printf("%x-%x s%v l%v z%v d%v\n", b.offset, b.offset+b.length, b.state, l, z, b.dirtyID)
return true
})
}
Expand Down

0 comments on commit 2366e87

Please sign in to comment.