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
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 {
...
@@ -17,41 +17,41 @@ func BulkStat(parallelism int, files []string) float64 {
todo
:=
make
(
chan
string
,
len
(
files
))
todo
:=
make
(
chan
string
,
len
(
files
))
dts
:=
make
(
chan
time
.
Duration
,
parallelism
)
dts
:=
make
(
chan
time
.
Duration
,
parallelism
)
allStart
:=
time
.
Now
()
fmt
.
Printf
(
"Statting %d files with %d threads
\n
"
,
len
(
files
),
parallelism
)
fmt
.
Printf
(
"Statting %d files with %d threads
\n
"
,
len
(
files
),
parallelism
)
for
i
:=
0
;
i
<
parallelism
;
i
++
{
for
i
:=
0
;
i
<
parallelism
;
i
++
{
go
func
()
{
go
func
()
{
t
:=
time
.
Now
()
for
{
for
{
fn
:=
<-
todo
fn
:=
<-
todo
if
fn
==
""
{
if
fn
==
""
{
break
break
}
}
t
:=
time
.
Now
()
_
,
err
:=
os
.
Lstat
(
fn
)
_
,
err
:=
os
.
Lstat
(
fn
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
"All stats should succeed:"
,
err
)
log
.
Fatal
(
"All stats should succeed:"
,
err
)
}
}
dts
<-
time
.
Now
()
.
Sub
(
t
)
}
}
dts
<-
time
.
Now
()
.
Sub
(
t
)
}()
}()
}
}
allStart
:=
time
.
Now
()
for
_
,
v
:=
range
files
{
for
_
,
v
:=
range
files
{
todo
<-
v
todo
<-
v
}
}
close
(
todo
)
total
:=
0.0
total
:=
0.0
for
i
:=
0
;
i
<
len
(
files
)
;
i
++
{
for
i
:=
0
;
i
<
parallelism
;
i
++
{
total
+=
(
<-
dts
)
.
Seconds
()
*
1e-3
total
+=
float64
(
<-
dts
)
/
float64
(
time
.
Millisecond
)
}
}
all
End
:=
time
.
Now
(
)
all
Dt
:=
time
.
Now
()
.
Sub
(
allStart
)
avg
:=
total
/
float64
(
len
(
files
))
avg
:=
total
/
float64
(
len
(
files
))
fmt
.
Printf
(
"Elapsed: %f sec. Average stat %f ms
\n
"
,
fmt
.
Printf
(
"Elapsed: %f sec. Average stat %f ms
\n
"
,
all
End
.
Sub
(
allStart
)
.
Seconds
(),
avg
)
all
Dt
.
Seconds
(),
avg
)
return
avg
return
avg
}
}
...
...
benchmark/stat_test.go
View file @
1cc3d953
...
@@ -254,8 +254,8 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
...
@@ -254,8 +254,8 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
}
}
// Wait for the daemon to mount.
// Wait for the daemon to mount.
time
.
Sleep
(
0.2e9
)
time
.
Sleep
(
200
*
time
.
Millisecond
)
ttl
:=
1.0
ttl
:=
time
.
Second
log
.
Println
(
"N = "
,
b
.
N
)
log
.
Println
(
"N = "
,
b
.
N
)
threads
:=
runtime
.
GOMAXPROCS
(
0
)
threads
:=
runtime
.
GOMAXPROCS
(
0
)
results
:=
TestingBOnePass
(
b
,
threads
,
time
.
Duration
((
ttl
*
12
)
/
10
),
lines
)
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