mirror of
https://codeberg.org/scip/io-exporter.git
synced 2025-12-18 21:11:01 +01:00
separate read and write tests, collect separate latencies
This commit is contained in:
23
cmd/alloc.go
23
cmd/alloc.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user