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
1cc3d953
Commit
1cc3d953
authored
Dec 07, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Benchmark: timing fixes.
Move timer out of inner loop.
parent
48305247
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
benchmark/benchmark.go
benchmark/benchmark.go
+9
-9
benchmark/stat_test.go
benchmark/stat_test.go
+2
-2
No files found.
benchmark/benchmark.go
View file @
1cc3d953
...
...
@@ -17,41 +17,41 @@ func BulkStat(parallelism int, files []string) float64 {
todo
:=
make
(
chan
string
,
len
(
files
))
dts
:=
make
(
chan
time
.
Duration
,
parallelism
)
allStart
:=
time
.
Now
()
fmt
.
Printf
(
"Statting %d files with %d threads
\n
"
,
len
(
files
),
parallelism
)
for
i
:=
0
;
i
<
parallelism
;
i
++
{
go
func
()
{
t
:=
time
.
Now
()
for
{
fn
:=
<-
todo
if
fn
==
""
{
break
}
t
:=
time
.
Now
()
_
,
err
:=
os
.
Lstat
(
fn
)
if
err
!=
nil
{
log
.
Fatal
(
"All stats should succeed:"
,
err
)
}
dts
<-
time
.
Now
()
.
Sub
(
t
)
}
dts
<-
time
.
Now
()
.
Sub
(
t
)
}()
}
allStart
:=
time
.
Now
()
for
_
,
v
:=
range
files
{
todo
<-
v
}
close
(
todo
)
total
:=
0.0
for
i
:=
0
;
i
<
len
(
files
)
;
i
++
{
total
+=
(
<-
dts
)
.
Seconds
()
*
1e-3
for
i
:=
0
;
i
<
parallelism
;
i
++
{
total
+=
float64
(
<-
dts
)
/
float64
(
time
.
Millisecond
)
}
all
End
:=
time
.
Now
(
)
all
Dt
:=
time
.
Now
()
.
Sub
(
allStart
)
avg
:=
total
/
float64
(
len
(
files
))
fmt
.
Printf
(
"Elapsed: %f sec. Average stat %f ms
\n
"
,
all
End
.
Sub
(
allStart
)
.
Seconds
(),
avg
)
all
Dt
.
Seconds
(),
avg
)
return
avg
}
...
...
benchmark/stat_test.go
View file @
1cc3d953
...
...
@@ -254,8 +254,8 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
}
// Wait for the daemon to mount.
time
.
Sleep
(
0.2e9
)
ttl
:=
1.0
time
.
Sleep
(
200
*
time
.
Millisecond
)
ttl
:=
time
.
Second
log
.
Println
(
"N = "
,
b
.
N
)
threads
:=
runtime
.
GOMAXPROCS
(
0
)
results
:=
TestingBOnePass
(
b
,
threads
,
time
.
Duration
((
ttl
*
12
)
/
10
),
lines
)
...
...
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