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
9bebb442
Commit
9bebb442
authored
Mar 30, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make bulkstat tunable over the command line.
parent
22c2700d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
example/bulkstat/bulkstat.go
example/bulkstat/bulkstat.go
+14
-11
No files found.
example/bulkstat/bulkstat.go
View file @
9bebb442
...
@@ -12,6 +12,10 @@ import (
...
@@ -12,6 +12,10 @@ import (
)
)
func
main
()
{
func
main
()
{
threads
:=
flag
.
Int
(
"threads"
,
12
,
"number of parallel threads in a run."
)
sleepTime
:=
flag
.
Float64
(
"sleep"
,
4.0
,
"amount of sleep between runs."
)
runs
:=
flag
.
Int
(
"runs"
,
10
,
"number of runs."
)
flag
.
Parse
()
flag
.
Parse
()
filename
:=
flag
.
Args
()[
0
]
filename
:=
flag
.
Args
()[
0
]
...
@@ -32,27 +36,26 @@ func main() {
...
@@ -32,27 +36,26 @@ func main() {
files
=
append
(
files
,
string
(
l
))
files
=
append
(
files
,
string
(
l
))
}
}
runs
:=
10
tot
:=
0.0
tot
:=
0.0
sleeptime
:=
4.0
for
j
:=
*
runs
;
j
>
0
;
j
--
{
for
j
:=
0
;
j
<
runs
;
j
++
{
tot
+=
BulkStat
(
*
threads
,
files
)
tot
+=
BulkStat
(
10
,
files
)
if
j
>
1
{
fmt
.
Printf
(
"Sleeping %.2f seconds
\n
"
,
sleeptime
)
fmt
.
Printf
(
"Sleeping %.2f seconds
\n
"
,
*
sleepTime
)
time
.
Sleep
(
int64
(
sleeptime
*
1e9
))
time
.
Sleep
(
int64
(
*
sleepTime
*
1e9
))
}
}
}
fmt
.
Printf
(
"Average of %d runs: %f ms
\n
"
,
runs
,
tot
/
float64
(
runs
))
fmt
.
Printf
(
"Average of %d runs: %f ms
\n
"
,
*
runs
,
tot
/
float64
(
*
runs
))
}
}
func
BulkStat
(
parallelism
int
,
files
[]
string
)
float64
{
func
BulkStat
(
parallelism
int
,
files
[]
string
)
float64
{
parallel
:=
10
todo
:=
make
(
chan
string
,
len
(
files
))
todo
:=
make
(
chan
string
,
len
(
files
))
dts
:=
make
(
chan
int64
,
parallel
)
dts
:=
make
(
chan
int64
,
parallel
ism
)
allStart
:=
time
.
Nanoseconds
()
allStart
:=
time
.
Nanoseconds
()
fmt
.
Printf
(
"Statting %d files with %d threads
\n
"
,
len
(
files
),
parallel
)
fmt
.
Printf
(
"Statting %d files with %d threads
\n
"
,
len
(
files
),
parallel
ism
)
for
i
:=
0
;
i
<
parallel
;
i
++
{
for
i
:=
0
;
i
<
parallel
ism
;
i
++
{
go
func
()
{
go
func
()
{
for
{
for
{
fn
:=
<-
todo
fn
:=
<-
todo
...
...
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