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
baaeff99
Commit
baaeff99
authored
May 19, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for artificial delays in benchmark.
parent
24a5a394
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
benchmark/stat_test.go
benchmark/stat_test.go
+11
-1
benchmark/statfs.cc
benchmark/statfs.cc
+12
-1
No files found.
benchmark/stat_test.go
View file @
baaeff99
...
...
@@ -17,11 +17,14 @@ import (
)
var
CheckSuccess
=
fuse
.
CheckSuccess
var
delay
=
0
*
time
.
Microsecond
type
StatFs
struct
{
fuse
.
DefaultFileSystem
entries
map
[
string
]
*
fuse
.
Attr
dirs
map
[
string
][]
fuse
.
DirEntry
delay
time
.
Duration
}
func
(
me
*
StatFs
)
add
(
name
string
,
a
*
fuse
.
Attr
)
{
...
...
@@ -47,6 +50,10 @@ func (me *StatFs) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.
if
e
==
nil
{
return
nil
,
fuse
.
ENOENT
}
if
me
.
delay
>
0
{
time
.
Sleep
(
me
.
delay
)
}
return
e
,
fuse
.
OK
}
...
...
@@ -152,6 +159,7 @@ func GetTestLines() []string {
func
BenchmarkGoFuseThreadedStat
(
b
*
testing
.
B
)
{
b
.
StopTimer
()
fs
:=
NewStatFs
()
fs
.
delay
=
delay
files
:=
GetTestLines
()
for
_
,
fn
:=
range
files
{
fs
.
add
(
fn
,
&
fuse
.
Attr
{
Mode
:
fuse
.
S_IFREG
|
0644
})
...
...
@@ -239,7 +247,9 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
"-o"
,
"entry_timeout=0.0,attr_timeout=0.0,ac_attr_timeout=0.0,negative_timeout=0.0"
,
mountPoint
)
cmd
.
Env
=
append
(
os
.
Environ
(),
fmt
.
Sprintf
(
"STATFS_INPUT=%s"
,
f
.
Name
()))
cmd
.
Env
=
append
(
os
.
Environ
(),
fmt
.
Sprintf
(
"STATFS_INPUT=%s"
,
f
.
Name
()),
fmt
.
Sprintf
(
"STATFS_DELAY_USEC=%d"
,
delay
/
time
.
Microsecond
))
cmd
.
Start
()
bin
,
err
:=
exec
.
LookPath
(
"fusermount"
)
...
...
benchmark/statfs.cc
View file @
baaeff99
...
...
@@ -18,7 +18,9 @@ extern "C" {
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
useconds_t
delay_usec
;
class
StatFs
{
public:
...
...
@@ -42,6 +44,10 @@ public:
statbuf
->
st_mode
=
S_IFREG
|
0666
;
}
if
(
delay_usec
>
0
)
{
usleep
(
delay_usec
);
}
return
0
;
}
...
...
@@ -82,6 +88,11 @@ int main(int argc, char *argv[])
}
global
->
readFrom
(
in
);
in
=
getenv
(
"STATFS_DELAY_USEC"
);
if
(
in
!=
NULL
)
{
delay_usec
=
atoi
(
in
);
}
struct
fuse_operations
statfs_oper
=
{
0
};
statfs_oper
.
getattr
=
&
global_getattr
;
return
fuse_main
(
argc
,
argv
,
&
statfs_oper
,
NULL
);
...
...
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