Skip to content

Commit 2366e87

Browse files
committed
Improve BufferList debug dump
1 parent 0ca77ff commit 2366e87

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

internal/buffer_list.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ func (l *BufferList) Ascend(offset uint64, iter func(end uint64, b *FileBuffer)
169169
ascendChange(&l.at, offset, iter)
170170
}
171171

172+
func (l *BufferList) Count() int {
173+
return l.at.Len()
174+
}
175+
172176
func (l *BufferList) EvictFromMemory(buf *FileBuffer) (allocated int64, deleted bool) {
173177
// Release memory
174178
buf.ptr.refs--
@@ -642,7 +646,15 @@ func (l *BufferList) Dump(offset, size uint64) {
642646
if b.offset >= offset+size {
643647
return false
644648
}
645-
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)
649+
l := 0
650+
if b.loading {
651+
l = 1
652+
}
653+
z := 0
654+
if b.zero {
655+
z = 1
656+
}
657+
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)
646658
return true
647659
})
648660
}

0 commit comments

Comments
 (0)