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
7fd5694d
Commit
7fd5694d
authored
Mar 15, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep operation latency stats.
parent
12f48f18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
example/loopback.go
example/loopback.go
+1
-1
fuse/fuse.go
fuse/fuse.go
+7
-2
No files found.
example/loopback.go
View file @
7fd5694d
...
@@ -57,7 +57,7 @@ func main() {
...
@@ -57,7 +57,7 @@ func main() {
fmt
.
Println
(
"Finished"
,
state
.
Stats
())
fmt
.
Println
(
"Finished"
,
state
.
Stats
())
for
v
:=
range
expvar
.
Iter
()
{
for
v
:=
range
expvar
.
Iter
()
{
if
strings
.
HasPrefix
(
v
.
Key
,
"
mount
"
)
{
if
strings
.
HasPrefix
(
v
.
Key
,
"
fuse_
"
)
{
fmt
.
Printf
(
"%v: %v
\n
"
,
v
.
Key
,
v
.
Value
)
fmt
.
Printf
(
"%v: %v
\n
"
,
v
.
Key
,
v
.
Value
)
}
}
}
}
...
...
fuse/fuse.go
View file @
7fd5694d
...
@@ -78,6 +78,7 @@ type MountState struct {
...
@@ -78,6 +78,7 @@ type MountState struct {
buffers
*
BufferPool
buffers
*
BufferPool
operationCounts
*
expvar
.
Map
operationCounts
*
expvar
.
Map
operationLatencies
*
expvar
.
Map
}
}
func
(
me
*
MountState
)
RegisterFile
(
file
RawFuseFile
)
uint64
{
func
(
me
*
MountState
)
RegisterFile
(
file
RawFuseFile
)
uint64
{
...
@@ -138,7 +139,8 @@ func (me *MountState) Mount(mountPoint string) os.Error {
...
@@ -138,7 +139,8 @@ func (me *MountState) Mount(mountPoint string) os.Error {
me
.
mountPoint
=
mp
me
.
mountPoint
=
mp
me
.
mountFile
=
file
me
.
mountFile
=
file
me
.
operationCounts
=
expvar
.
NewMap
(
fmt
.
Sprintf
(
"mount(%v)"
,
mountPoint
))
me
.
operationCounts
=
expvar
.
NewMap
(
fmt
.
Sprintf
(
"fuse_op_count(%v)"
,
mountPoint
))
me
.
operationLatencies
=
expvar
.
NewMap
(
fmt
.
Sprintf
(
"fuse_op_latency_ms(%v)"
,
mountPoint
))
return
nil
return
nil
}
}
...
@@ -260,6 +262,10 @@ func (me *MountState) newFuseRequest() (*fuseRequest, os.Error) {
...
@@ -260,6 +262,10 @@ func (me *MountState) newFuseRequest() (*fuseRequest, os.Error) {
}
}
func
(
me
*
MountState
)
discardFuseRequest
(
req
*
fuseRequest
)
{
func
(
me
*
MountState
)
discardFuseRequest
(
req
*
fuseRequest
)
{
dt
:=
time
.
Nanoseconds
()
-
req
.
startNs
me
.
operationLatencies
.
Add
(
operationName
(
req
.
inHeader
.
Opcode
),
dt
/
1e6
)
me
.
buffers
.
FreeBuffer
(
req
.
inputBuf
)
me
.
buffers
.
FreeBuffer
(
req
.
inputBuf
)
me
.
buffers
.
FreeBuffer
(
req
.
flatData
)
me
.
buffers
.
FreeBuffer
(
req
.
flatData
)
}
}
...
@@ -340,7 +346,6 @@ func (me *MountState) dispatch(req *fuseRequest) {
...
@@ -340,7 +346,6 @@ func (me *MountState) dispatch(req *fuseRequest) {
h
.
Opcode
==
FUSE_LINK
{
h
.
Opcode
==
FUSE_LINK
{
filename
=
strings
.
TrimRight
(
string
(
req
.
arg
.
Bytes
()),
"
\x00
"
)
filename
=
strings
.
TrimRight
(
string
(
req
.
arg
.
Bytes
()),
"
\x00
"
)
}
}
if
me
.
Debug
{
if
me
.
Debug
{
nm
:=
""
nm
:=
""
if
filename
!=
""
{
if
filename
!=
""
{
...
...
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