mount: print more things in seek_speed test

This commit is contained in:
Nick Craig-Wood 2019-02-02 11:30:04 +00:00
parent 7b20139c6a
commit f8ced557e3

View file

@ -20,12 +20,12 @@ var (
)
func randomSeekTest(size int64, in *os.File, name string) {
startTime := time.Now()
start := rand.Int63n(size)
blockSize := rand.Intn(*maxBlockSize)
if int64(blockSize) > size-start {
blockSize = int(size - start)
}
log.Printf("Reading %d from %d", blockSize, start)
_, err := in.Seek(start, io.SeekStart)
if err != nil {
@ -37,6 +37,8 @@ func randomSeekTest(size int64, in *os.File, name string) {
if err != nil {
log.Fatalf("Read failed on %q: %v", name, err)
}
log.Printf("Reading %d from %d took %v ", blockSize, start, time.Since(startTime))
}
func main() {
@ -48,10 +50,12 @@ func main() {
rand.Seed(*randSeed)
name := args[0]
openStart := time.Now()
in, err := os.Open(name)
if err != nil {
log.Fatalf("Couldn't open %q: %v", name, err)
}
log.Printf("File Open took %v", time.Since(openStart))
fi, err := in.Stat()
if err != nil {