From f8ced557e38885e20f9cffb82006b2a81086ba72 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 2 Feb 2019 11:30:04 +0000 Subject: [PATCH] mount: print more things in seek_speed test --- cmd/mount/test/seek_speed.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/mount/test/seek_speed.go b/cmd/mount/test/seek_speed.go index 390c42497..daf502828 100644 --- a/cmd/mount/test/seek_speed.go +++ b/cmd/mount/test/seek_speed.go @@ -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 {