mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:54:44 +01:00
mount: print more things in seek_speed test
This commit is contained in:
parent
7b20139c6a
commit
f8ced557e3
@ -20,12 +20,12 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func randomSeekTest(size int64, in *os.File, name string) {
|
func randomSeekTest(size int64, in *os.File, name string) {
|
||||||
|
startTime := time.Now()
|
||||||
start := rand.Int63n(size)
|
start := rand.Int63n(size)
|
||||||
blockSize := rand.Intn(*maxBlockSize)
|
blockSize := rand.Intn(*maxBlockSize)
|
||||||
if int64(blockSize) > size-start {
|
if int64(blockSize) > size-start {
|
||||||
blockSize = int(size - start)
|
blockSize = int(size - start)
|
||||||
}
|
}
|
||||||
log.Printf("Reading %d from %d", blockSize, start)
|
|
||||||
|
|
||||||
_, err := in.Seek(start, io.SeekStart)
|
_, err := in.Seek(start, io.SeekStart)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -37,6 +37,8 @@ func randomSeekTest(size int64, in *os.File, name string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Read failed on %q: %v", name, err)
|
log.Fatalf("Read failed on %q: %v", name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Printf("Reading %d from %d took %v ", blockSize, start, time.Since(startTime))
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -48,10 +50,12 @@ func main() {
|
|||||||
rand.Seed(*randSeed)
|
rand.Seed(*randSeed)
|
||||||
|
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
openStart := time.Now()
|
||||||
in, err := os.Open(name)
|
in, err := os.Open(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Couldn't open %q: %v", name, err)
|
log.Fatalf("Couldn't open %q: %v", name, err)
|
||||||
}
|
}
|
||||||
|
log.Printf("File Open took %v", time.Since(openStart))
|
||||||
|
|
||||||
fi, err := in.Stat()
|
fi, err := in.Stat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user