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
0b0f4ddb
Commit
0b0f4ddb
authored
Jan 18, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log the number of FUSE operations in an expvar.
parent
ce1a82ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
example/main.go
example/main.go
+8
-0
fuse/fuse.go
fuse/fuse.go
+9
-1
No files found.
example/main.go
View file @
0b0f4ddb
...
...
@@ -5,8 +5,10 @@ import (
"github.com/hanwen/go-fuse/examplelib"
"fmt"
"os"
"expvar"
"flag"
"runtime"
"strings"
)
func
main
()
{
...
...
@@ -36,4 +38,10 @@ func main() {
fmt
.
Printf
(
"Mounted %s on %s (threaded=%v, debug=%v, cpus=%v)
\n
"
,
orig
,
mountPoint
,
*
threaded
,
*
debug
,
cpus
)
state
.
Loop
(
*
threaded
)
fmt
.
Println
(
"Finished"
,
state
.
Stats
())
for
v
:=
range
(
expvar
.
Iter
())
{
if
strings
.
HasPrefix
(
v
.
Key
,
"mount"
)
{
fmt
.
Printf
(
"%v: %v
\n
"
,
v
.
Key
,
v
.
Value
)
}
}
}
fuse/fuse.go
View file @
0b0f4ddb
...
...
@@ -3,6 +3,7 @@ package fuse
import
(
"bytes"
"encoding/binary"
"expvar"
"fmt"
"log"
"os"
...
...
@@ -11,7 +12,6 @@ import (
"syscall"
)
// TODO make generic option setting.
const
(
// bufSize should be a power of two to minimize lossage in
...
...
@@ -56,6 +56,8 @@ type MountState struct {
// For efficient reads.
buffers
*
BufferPool
operationCounts
*
expvar
.
Map
}
func
(
self
*
MountState
)
RegisterFile
(
file
RawFuseFile
)
uint64
{
...
...
@@ -115,6 +117,8 @@ func (self *MountState) Mount(mountPoint string) os.Error {
}
self
.
mountPoint
=
mp
self
.
mountFile
=
file
self
.
operationCounts
=
expvar
.
NewMap
(
fmt
.
Sprintf
(
"mount(%v)"
,
mountPoint
))
return
nil
}
...
...
@@ -184,6 +188,7 @@ func NewMountState(fs RawFileSystem) *MountState {
self
.
fileSystem
=
fs
self
.
buffers
=
NewBufferPool
()
return
self
}
// TODO - more of them.
...
...
@@ -269,6 +274,9 @@ func (self *MountState) handle(in_data []byte) {
func
dispatch
(
state
*
MountState
,
h
*
InHeader
,
arg
*
bytes
.
Buffer
)
(
outBytes
[][]
byte
)
{
// TODO - would be nice to remove this logging from the critical path.
state
.
operationCounts
.
Add
(
operationName
(
h
.
Opcode
),
1
)
input
:=
newInput
(
h
.
Opcode
)
if
input
!=
nil
&&
!
parseLittleEndian
(
arg
,
input
)
{
return
serialize
(
h
,
EIO
,
nil
,
nil
,
false
)
...
...
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