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
Levin Zimmermann
go-fuse
Commits
99f887ce
Commit
99f887ce
authored
May 21, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop extra cache heating run in benchmark; use b.N as stat count instead.
parent
6db54109
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
30 deletions
+16
-30
benchmark/benchmark.go
benchmark/benchmark.go
+5
-9
benchmark/stat_test.go
benchmark/stat_test.go
+11
-21
No files found.
benchmark/benchmark.go
View file @
99f887ce
...
...
@@ -56,7 +56,7 @@ func BulkStat(parallelism int, files []string) float64 {
return
avg
}
func
AnalyzeBenchmarkRuns
(
times
[]
float64
)
{
func
AnalyzeBenchmarkRuns
(
label
string
,
times
[]
float64
)
{
sorted
:=
times
sort
.
Float64s
(
sorted
)
...
...
@@ -80,22 +80,18 @@ func AnalyzeBenchmarkRuns(times []float64) {
perc10
:=
sorted
[
int
(
n
*
0.1
)]
fmt
.
Printf
(
"%d samples
\n
"
+
"avg %.3f
ms 2sigma %.3f
"
+
"%
s: %
d samples
\n
"
+
"avg %.3f
ms 2sigma %.3fms
"
+
"median %.3fms
\n
"
+
"10%%tile %.3fms, 90%%tile %.3fms
\n
"
,
label
,
len
(
times
),
avg
,
2
*
stddev
,
median
,
perc10
,
perc90
)
}
func
RunBulkStat
(
runs
int
,
threads
int
,
sleepTime
time
.
Duration
,
files
[]
string
)
(
results
[]
float64
)
{
runs
++
for
j
:=
0
;
j
<
runs
;
j
++
{
result
:=
BulkStat
(
threads
,
files
)
if
j
>
0
{
results
=
append
(
results
,
result
)
}
else
{
fmt
.
Println
(
"Ignoring first run to preheat caches."
)
}
if
j
<
runs
-
1
{
fmt
.
Printf
(
"Sleeping %.2f seconds
\n
"
,
sleepTime
)
...
...
benchmark/stat_test.go
View file @
99f887ce
...
...
@@ -183,37 +183,29 @@ func BenchmarkGoFuseThreadedStat(b *testing.B) {
files
[
i
]
=
filepath
.
Join
(
wd
,
l
)
}
log
.
Println
(
"N = "
,
b
.
N
)
threads
:=
runtime
.
GOMAXPROCS
(
0
)
results
:=
TestingBOnePass
(
b
,
threads
,
time
.
Duration
((
ttl
*
120
)
/
100
),
files
)
AnalyzeBenchmarkRuns
(
results
)
AnalyzeBenchmarkRuns
(
"Go-FUSE"
,
results
)
}
func
TestingBOnePass
(
b
*
testing
.
B
,
threads
int
,
sleepTime
time
.
Duration
,
files
[]
string
)
(
results
[]
float64
)
{
runtime
.
GC
()
runs
:=
b
.
N
+
1
for
j
:=
0
;
j
<
runs
;
j
++
{
if
j
>
0
{
b
.
StartTimer
()
todo
:=
b
.
N
for
todo
>
0
{
if
len
(
files
)
>
todo
{
files
=
files
[
:
todo
]
}
b
.
StartTimer
()
result
:=
BulkStat
(
threads
,
files
)
if
j
>
0
{
todo
-=
len
(
files
)
b
.
StopTimer
()
results
=
append
(
results
,
result
)
}
else
{
fmt
.
Println
(
"Ignoring first run to preheat caches."
)
}
if
j
<
runs
-
1
{
fmt
.
Printf
(
"Sleeping %.2f seconds
\n
"
,
sleepTime
.
Seconds
())
time
.
Sleep
(
sleepTime
)
}
}
return
results
}
func
BenchmarkCFuseThreadedStat
(
b
*
testing
.
B
)
{
log
.
Println
(
"benchmarking CFuse"
)
b
.
StopTimer
(
)
lines
:=
GetTestLines
()
unique
:=
map
[
string
]
int
{}
...
...
@@ -240,7 +232,6 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
}
f
.
Close
()
log
.
Println
(
"Written:"
,
f
.
Name
())
mountPoint
,
_
:=
ioutil
.
TempDir
(
""
,
"stat_test"
)
wd
,
_
:=
os
.
Getwd
()
cmd
:=
exec
.
Command
(
wd
+
"/cstatfs"
,
...
...
@@ -265,8 +256,7 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
// Wait for the daemon to mount.
time
.
Sleep
(
200
*
time
.
Millisecond
)
ttl
:=
time
.
Millisecond
*
100
log
.
Println
(
"N = "
,
b
.
N
)
threads
:=
runtime
.
GOMAXPROCS
(
0
)
results
:=
TestingBOnePass
(
b
,
threads
,
time
.
Duration
((
ttl
*
12
)
/
10
),
lines
)
AnalyzeBenchmarkRuns
(
results
)
AnalyzeBenchmarkRuns
(
"CFuse"
,
results
)
}
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