separate read and write tests, collect separate latencies

This commit is contained in:
2025-10-22 17:53:46 +02:00
parent 8b3cf64e96
commit 08fe283e10
6 changed files with 175 additions and 68 deletions

View File

@@ -1,11 +1,23 @@
package cmd
import "github.com/ncw/directio"
import (
"bytes"
"errors"
"github.com/ncw/directio"
)
const (
O_R = iota
O_W
O_RW
)
// aligned allocs used for testing
type Alloc struct {
writeBlock []byte
readBlock []byte
mode int
}
// zero the memory blocks
@@ -25,3 +37,12 @@ func NewAlloc() *Alloc {
readBlock: directio.AlignedBlock(directio.BlockSize),
}
}
func (alloc *Alloc) Compare() bool {
// compare
if !bytes.Equal(alloc.writeBlock, alloc.readBlock) {
return die(errors.New("read not the same as written"), nil)
}
return true
}