storage/filestore: benchmark diskInfoFromPath
Change-Id: I996057b1c650aec7cec84b49877d1e184a12514e
This commit is contained in:
parent
18914e4d1a
commit
fca4f43a04
@ -3,7 +3,11 @@
|
||||
|
||||
package filestore
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDiskInfoFromPath(t *testing.T) {
|
||||
info, err := diskInfoFromPath(".")
|
||||
@ -19,3 +23,18 @@ func TestDiskInfoFromPath(t *testing.T) {
|
||||
|
||||
t.Logf("Got: %v %v", info.ID, info.AvailableSpace)
|
||||
}
|
||||
|
||||
func BenchmarkDiskInfoFromPath(b *testing.B) {
|
||||
homedir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
b.Run(fmt.Sprintf("dir=%q", homedir), func(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err = diskInfoFromPath(homedir)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user