mount: print more things in seek_speed test
This commit is contained in:
parent
7b20139c6a
commit
f8ced557e3
1 changed files with 5 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue