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
ac9c5fa8
Commit
ac9c5fa8
authored
Mar 25, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do a couple of runs and show the average.
parent
2b2af11c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
example/bulkstat/bulkstat.go
example/bulkstat/bulkstat.go
+22
-1
No files found.
example/bulkstat/bulkstat.go
View file @
ac9c5fa8
...
...
@@ -32,10 +32,25 @@ func main() {
files
=
append
(
files
,
string
(
l
))
}
runs
:=
10
tot
:=
0.0
sleeptime
:=
4.0
for
j
:=
0
;
j
<
runs
;
j
++
{
tot
+=
BulkStat
(
10
,
files
)
fmt
.
Printf
(
"Sleeping %.2f seconds
\n
"
,
sleeptime
)
time
.
Sleep
(
int64
(
sleeptime
*
1e9
))
}
fmt
.
Printf
(
"Average of %d runs: %f ms
\n
"
,
runs
,
tot
/
float64
(
runs
))
}
func
BulkStat
(
parallelism
int
,
files
[]
string
)
float64
{
parallel
:=
10
todo
:=
make
(
chan
string
,
len
(
files
))
dts
:=
make
(
chan
int64
,
parallel
)
allStart
:=
time
.
Nanoseconds
()
fmt
.
Printf
(
"Statting %d files with %d threads
\n
"
,
len
(
files
),
parallel
)
for
i
:=
0
;
i
<
parallel
;
i
++
{
go
func
()
{
...
...
@@ -61,5 +76,11 @@ func main() {
total
+=
float64
(
<-
dts
)
*
1e-6
}
fmt
.
Println
(
"Average stat time (ms):"
,
total
/
float64
(
len
(
files
)))
allEnd
:=
time
.
Nanoseconds
()
avg
:=
total
/
float64
(
len
(
files
))
fmt
.
Printf
(
"Elapsed: %f sec. Average stat %f ms
\n
"
,
float64
(
allEnd
-
allStart
)
*
1e-9
,
avg
)
return
avg
}
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