Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go-fuse
Commits
50cd8164
Commit
50cd8164
authored
Aug 25, 2024
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
benchmark: modernize setupFS
Change-Id: I0dd07cf43fded2aa28ff83b2797e9222ae6e1295
parent
ab014071
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
19 deletions
+13
-19
benchmark/read_test.go
benchmark/read_test.go
+1
-2
benchmark/stat_test.go
benchmark/stat_test.go
+12
-17
No files found.
benchmark/read_test.go
View file @
50cd8164
...
@@ -24,8 +24,7 @@ func BenchmarkGoFuseMemoryRead(b *testing.B) {
...
@@ -24,8 +24,7 @@ func BenchmarkGoFuseMemoryRead(b *testing.B) {
const
blockSize
=
64
*
1024
const
blockSize
=
64
*
1024
func
benchmarkGoFuseRead
(
root
fs
.
InodeEmbedder
,
b
*
testing
.
B
)
{
func
benchmarkGoFuseRead
(
root
fs
.
InodeEmbedder
,
b
*
testing
.
B
)
{
wd
,
clean
:=
setupFs
(
root
,
b
.
N
)
wd
:=
setupFS
(
root
,
b
.
N
,
b
)
defer
clean
()
jobs
:=
32
jobs
:=
32
cmds
:=
make
([]
*
exec
.
Cmd
,
jobs
)
cmds
:=
make
([]
*
exec
.
Cmd
,
jobs
)
...
...
benchmark/stat_test.go
View file @
50cd8164
...
@@ -22,22 +22,19 @@ import (
...
@@ -22,22 +22,19 @@ import (
"github.com/hanwen/go-fuse/v2/internal/testutil"
"github.com/hanwen/go-fuse/v2/internal/testutil"
)
)
func
setupF
s
(
node
fs
.
InodeEmbedder
,
N
int
)
(
string
,
func
())
{
func
setupF
S
(
node
fs
.
InodeEmbedder
,
N
int
,
tb
testing
.
TB
)
string
{
opts
:=
&
fs
.
Options
{}
opts
:=
&
fs
.
Options
{}
opts
.
Debug
=
testutil
.
VerboseTest
()
opts
.
Debug
=
testutil
.
VerboseTest
()
mountPoint
,
err
:=
os
.
MkdirTemp
(
""
,
""
)
mountPoint
:=
tb
.
TempDir
()
if
err
!=
nil
{
log
.
Panicf
(
"TempDir: %v"
,
err
)
}
server
,
err
:=
fs
.
Mount
(
mountPoint
,
node
,
opts
)
server
,
err
:=
fs
.
Mount
(
mountPoint
,
node
,
opts
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Panic
f
(
"cannot mount %v"
,
err
)
tb
.
Fatal
f
(
"cannot mount %v"
,
err
)
}
}
lmap
:=
NewLatencyMap
()
lmap
:=
NewLatencyMap
()
if
testutil
.
VerboseTest
()
{
if
testutil
.
VerboseTest
()
{
server
.
RecordLatencies
(
lmap
)
server
.
RecordLatencies
(
lmap
)
}
}
return
mountPoint
,
func
()
{
tb
.
Cleanup
(
func
()
{
if
testutil
.
VerboseTest
()
{
if
testutil
.
VerboseTest
()
{
var
total
time
.
Duration
var
total
time
.
Duration
for
_
,
n
:=
range
[]
string
{
"LOOKUP"
,
"GETATTR"
,
"OPENDIR"
,
"READDIR"
,
for
_
,
n
:=
range
[]
string
{
"LOOKUP"
,
"GETATTR"
,
"OPENDIR"
,
"READDIR"
,
...
@@ -57,7 +54,8 @@ func setupFs(node fs.InodeEmbedder, N int) (string, func()) {
...
@@ -57,7 +54,8 @@ func setupFs(node fs.InodeEmbedder, N int) (string, func()) {
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Println
(
"error during unmount"
,
err
)
log
.
Println
(
"error during unmount"
,
err
)
}
}
}
})
return
mountPoint
}
}
func
TestNewStatFs
(
t
*
testing
.
T
)
{
func
TestNewStatFs
(
t
*
testing
.
T
)
{
...
@@ -68,8 +66,7 @@ func TestNewStatFs(t *testing.T) {
...
@@ -68,8 +66,7 @@ func TestNewStatFs(t *testing.T) {
fs
.
AddFile
(
n
,
fuse
.
Attr
{
Mode
:
syscall
.
S_IFREG
})
fs
.
AddFile
(
n
,
fuse
.
Attr
{
Mode
:
syscall
.
S_IFREG
})
}
}
wd
,
clean
:=
setupFs
(
fs
,
1
)
wd
:=
setupFS
(
fs
,
1
,
t
)
defer
clean
()
names
,
err
:=
ioutil
.
ReadDir
(
wd
)
names
,
err
:=
ioutil
.
ReadDir
(
wd
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -121,15 +118,14 @@ func BenchmarkGoFuseStat(b *testing.B) {
...
@@ -121,15 +118,14 @@ func BenchmarkGoFuseStat(b *testing.B) {
fs
.
AddFile
(
fn
,
fuse
.
Attr
{
Mode
:
syscall
.
S_IFREG
})
fs
.
AddFile
(
fn
,
fuse
.
Attr
{
Mode
:
syscall
.
S_IFREG
})
}
}
wd
,
clean
:=
setupFs
(
fs
,
b
.
N
)
mnt
:=
setupFS
(
fs
,
b
.
N
,
b
)
defer
clean
()
for
i
,
l
:=
range
files
{
for
i
,
l
:=
range
files
{
files
[
i
]
=
filepath
.
Join
(
wd
,
l
)
files
[
i
]
=
filepath
.
Join
(
mnt
,
l
)
}
}
threads
:=
runtime
.
GOMAXPROCS
(
0
)
threads
:=
runtime
.
GOMAXPROCS
(
0
)
if
err
:=
TestingBOnePass
(
b
,
threads
,
fileList
,
wd
);
err
!=
nil
{
if
err
:=
TestingBOnePass
(
b
,
threads
,
fileList
,
mnt
);
err
!=
nil
{
b
.
Fatalf
(
"TestingBOnePass %v8"
,
err
)
b
.
Fatalf
(
"TestingBOnePass %v8"
,
err
)
}
}
}
}
...
@@ -157,12 +153,11 @@ func BenchmarkGoFuseReaddir(b *testing.B) {
...
@@ -157,12 +153,11 @@ func BenchmarkGoFuseReaddir(b *testing.B) {
dirSet
[
filepath
.
Dir
(
fn
)]
=
struct
{}{}
dirSet
[
filepath
.
Dir
(
fn
)]
=
struct
{}{}
}
}
wd
,
clean
:=
setupFs
(
fs
,
b
.
N
)
mnt
:=
setupFS
(
fs
,
b
.
N
,
b
)
defer
clean
()
var
dirs
[]
string
var
dirs
[]
string
for
dir
:=
range
dirSet
{
for
dir
:=
range
dirSet
{
dirs
=
append
(
dirs
,
filepath
.
Join
(
wd
,
dir
))
dirs
=
append
(
dirs
,
filepath
.
Join
(
mnt
,
dir
))
}
}
b
.
StartTimer
()
b
.
StartTimer
()
todo
:=
b
.
N
todo
:=
b
.
N
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment