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
f1e3a827
Commit
f1e3a827
authored
Apr 26, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use LatencyMap to signal whether to record stats.
parent
2e0db5ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
8 deletions
+14
-8
example/loopback/loopback.go
example/loopback/loopback.go
+1
-1
example/zipfs/main.go
example/zipfs/main.go
+1
-1
fuse/fuse.go
fuse/fuse.go
+12
-6
No files found.
example/loopback/loopback.go
View file @
f1e3a827
...
...
@@ -73,7 +73,7 @@ func main() {
state
.
Debug
=
*
debug
if
*
latencies
{
state
.
RecordStatistics
=
true
state
.
SetRecordStatistics
(
true
)
debugFs
.
AddMountState
(
state
)
debugFs
.
AddFileSystemConnector
(
conn
)
}
...
...
example/zipfs/main.go
View file @
f1e3a827
...
...
@@ -44,7 +44,7 @@ func main() {
}
mountPoint
:=
flag
.
Arg
(
0
)
state
.
RecordStatistics
=
*
latencies
state
.
SetRecordStatistics
(
*
latencies
)
state
.
Debug
=
*
debug
state
.
Mount
(
mountPoint
)
...
...
fuse/fuse.go
View file @
f1e3a827
...
...
@@ -70,7 +70,6 @@ type MountState struct {
// For efficient reads and writes.
buffers
*
BufferPool
RecordStatistics
bool
*
LatencyMap
}
...
...
@@ -82,10 +81,17 @@ func (me *MountState) Mount(mountPoint string) os.Error {
}
me
.
mountPoint
=
mp
me
.
mountFile
=
file
me
.
LatencyMap
=
NewLatencyMap
()
return
nil
}
func
(
me
*
MountState
)
SetRecordStatistics
(
record
bool
)
{
if
record
{
me
.
LatencyMap
=
NewLatencyMap
()
}
else
{
me
.
LatencyMap
=
nil
}
}
func
(
me
*
MountState
)
Unmount
()
os
.
Error
{
// Todo: flush/release all files/dirs?
result
:=
unmount
(
me
.
mountPoint
)
...
...
@@ -96,7 +102,7 @@ func (me *MountState) Unmount() os.Error {
}
func
(
me
*
MountState
)
Write
(
req
*
request
)
{
if
me
.
RecordStatistics
{
if
me
.
LatencyMap
!=
nil
{
req
.
preWriteNs
=
time
.
Nanoseconds
()
}
...
...
@@ -153,7 +159,7 @@ func (me *MountState) readRequest(req *request) os.Error {
n
,
err
:=
me
.
mountFile
.
Read
(
req
.
inputBuf
)
// If we start timing before the read, we may take into
// account waiting for input into the timing.
if
me
.
RecordStatistics
{
if
me
.
LatencyMap
!=
nil
{
req
.
startNs
=
time
.
Nanoseconds
()
}
req
.
inputBuf
=
req
.
inputBuf
[
0
:
n
]
...
...
@@ -161,7 +167,7 @@ func (me *MountState) readRequest(req *request) os.Error {
}
func
(
me
*
MountState
)
discardRequest
(
req
*
request
)
{
if
me
.
RecordStatistics
{
if
me
.
LatencyMap
!=
nil
{
endNs
:=
time
.
Nanoseconds
()
dt
:=
endNs
-
req
.
startNs
...
...
@@ -273,7 +279,7 @@ func (me *MountState) handle(req *request) {
}
func
(
me
*
MountState
)
dispatch
(
req
*
request
,
handler
*
operationHandler
)
{
if
me
.
RecordStatistics
{
if
me
.
LatencyMap
!=
nil
{
req
.
dispatchNs
=
time
.
Nanoseconds
()
}
...
...
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