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
f819c7aa
Commit
f819c7aa
authored
Mar 17, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add raw wrapping FS, and raw timing FS.
parent
07b6ce53
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
286 additions
and
2 deletions
+286
-2
fuse/Makefile
fuse/Makefile
+2
-1
fuse/timingfs.go
fuse/timingfs.go
+1
-1
fuse/timingrawfs.go
fuse/timingrawfs.go
+173
-0
fuse/wrappedfs.go
fuse/wrappedfs.go
+110
-0
No files found.
fuse/Makefile
View file @
f819c7aa
...
...
@@ -15,7 +15,8 @@ GOFILES=misc.go\
datafile.go
\
loopback.go
\
wrappedfs.go
\
timingfs.go
timingfs.go
\
timingrawfs.go
include
$(GOROOT)/src/Make.pkg
fuse/timingfs.go
View file @
f819c7aa
...
...
@@ -5,7 +5,7 @@ import (
"time"
)
// TimingPathFilesystem is a wrapper to collect timings for a PathFilesystem
type
TimingPathFilesystem
struct
{
original
PathFilesystem
...
...
fuse/timingrawfs.go
0 → 100644
View file @
f819c7aa
package
fuse
import
(
"sync"
"time"
)
// TimingRawFilesystem is a wrapper to collect timings for a RawFilesystem
type
TimingRawFilesystem
struct
{
original
RawFileSystem
statisticsLock
sync
.
Mutex
latencies
map
[
string
]
int64
counts
map
[
string
]
int64
}
func
NewTimingRawFilesystem
(
fs
RawFileSystem
)
*
TimingRawFilesystem
{
t
:=
new
(
TimingRawFilesystem
)
t
.
original
=
fs
t
.
latencies
=
make
(
map
[
string
]
int64
)
t
.
counts
=
make
(
map
[
string
]
int64
)
return
t
}
func
(
me
*
TimingRawFilesystem
)
startTimer
(
name
string
)
(
closure
func
())
{
start
:=
time
.
Nanoseconds
()
return
func
()
{
dt
:=
(
time
.
Nanoseconds
()
-
start
)
/
1e6
me
.
statisticsLock
.
Lock
()
defer
me
.
statisticsLock
.
Unlock
()
me
.
counts
[
name
]
+=
1
me
.
latencies
[
name
]
+=
dt
}
}
func
(
me
*
TimingRawFilesystem
)
Latencies
()
map
[
string
]
float64
{
me
.
statisticsLock
.
Lock
()
defer
me
.
statisticsLock
.
Unlock
()
r
:=
make
(
map
[
string
]
float64
)
for
k
,
v
:=
range
me
.
counts
{
r
[
k
]
=
float64
(
me
.
latencies
[
k
])
/
float64
(
v
)
}
return
r
}
func
(
me
*
TimingRawFilesystem
)
Init
(
h
*
InHeader
,
input
*
InitIn
)
(
*
InitOut
,
Status
)
{
defer
me
.
startTimer
(
"Init"
)()
return
me
.
original
.
Init
(
h
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
Destroy
(
h
*
InHeader
,
input
*
InitIn
)
{
defer
me
.
startTimer
(
"Destroy"
)()
me
.
original
.
Destroy
(
h
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
Lookup
(
h
*
InHeader
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
defer
me
.
startTimer
(
"Lookup"
)()
return
me
.
original
.
Lookup
(
h
,
name
)
}
func
(
me
*
TimingRawFilesystem
)
Forget
(
h
*
InHeader
,
input
*
ForgetIn
)
{
defer
me
.
startTimer
(
"Forget"
)()
me
.
original
.
Forget
(
h
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
GetAttr
(
header
*
InHeader
,
input
*
GetAttrIn
)
(
out
*
AttrOut
,
code
Status
)
{
defer
me
.
startTimer
(
"GetAttr"
)()
return
me
.
original
.
GetAttr
(
header
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
Open
(
header
*
InHeader
,
input
*
OpenIn
)
(
flags
uint32
,
fuseFile
RawFuseFile
,
status
Status
)
{
defer
me
.
startTimer
(
"Open"
)()
return
me
.
original
.
Open
(
header
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
SetAttr
(
header
*
InHeader
,
input
*
SetAttrIn
)
(
out
*
AttrOut
,
code
Status
)
{
defer
me
.
startTimer
(
"SetAttr"
)()
return
me
.
original
.
SetAttr
(
header
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
Readlink
(
header
*
InHeader
)
(
out
[]
byte
,
code
Status
)
{
defer
me
.
startTimer
(
"Readlink"
)()
return
me
.
original
.
Readlink
(
header
)
}
func
(
me
*
TimingRawFilesystem
)
Mknod
(
header
*
InHeader
,
input
*
MknodIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
defer
me
.
startTimer
(
"Mknod"
)()
return
me
.
original
.
Mknod
(
header
,
input
,
name
)
}
func
(
me
*
TimingRawFilesystem
)
Mkdir
(
header
*
InHeader
,
input
*
MkdirIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
defer
me
.
startTimer
(
"Mkdir"
)()
return
me
.
original
.
Mkdir
(
header
,
input
,
name
)
}
func
(
me
*
TimingRawFilesystem
)
Unlink
(
header
*
InHeader
,
name
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Unlink"
)()
return
me
.
original
.
Unlink
(
header
,
name
)
}
func
(
me
*
TimingRawFilesystem
)
Rmdir
(
header
*
InHeader
,
name
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Rmdir"
)()
return
me
.
original
.
Rmdir
(
header
,
name
)
}
func
(
me
*
TimingRawFilesystem
)
Symlink
(
header
*
InHeader
,
pointedTo
string
,
linkName
string
)
(
out
*
EntryOut
,
code
Status
)
{
defer
me
.
startTimer
(
"Symlink"
)()
return
me
.
original
.
Symlink
(
header
,
pointedTo
,
linkName
)
}
func
(
me
*
TimingRawFilesystem
)
Rename
(
header
*
InHeader
,
input
*
RenameIn
,
oldName
string
,
newName
string
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Rename"
)()
return
me
.
original
.
Rename
(
header
,
input
,
oldName
,
newName
)
}
func
(
me
*
TimingRawFilesystem
)
Link
(
header
*
InHeader
,
input
*
LinkIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
defer
me
.
startTimer
(
"Link"
)()
return
me
.
original
.
Link
(
header
,
input
,
name
)
}
func
(
me
*
TimingRawFilesystem
)
SetXAttr
(
header
*
InHeader
,
input
*
SetXAttrIn
)
Status
{
defer
me
.
startTimer
(
"SetXAttr"
)()
return
me
.
original
.
SetXAttr
(
header
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
GetXAttr
(
header
*
InHeader
,
input
*
GetXAttrIn
)
(
out
*
GetXAttrOut
,
code
Status
)
{
defer
me
.
startTimer
(
"GetXAttr"
)()
return
me
.
original
.
GetXAttr
(
header
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
Access
(
header
*
InHeader
,
input
*
AccessIn
)
(
code
Status
)
{
defer
me
.
startTimer
(
"Access"
)()
return
me
.
original
.
Access
(
header
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
Create
(
header
*
InHeader
,
input
*
CreateIn
,
name
string
)
(
flags
uint32
,
fuseFile
RawFuseFile
,
out
*
EntryOut
,
code
Status
)
{
defer
me
.
startTimer
(
"Create"
)()
return
me
.
original
.
Create
(
header
,
input
,
name
)
}
func
(
me
*
TimingRawFilesystem
)
Bmap
(
header
*
InHeader
,
input
*
BmapIn
)
(
out
*
BmapOut
,
code
Status
)
{
defer
me
.
startTimer
(
"Bmap"
)()
return
me
.
original
.
Bmap
(
header
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
Ioctl
(
header
*
InHeader
,
input
*
IoctlIn
)
(
out
*
IoctlOut
,
code
Status
)
{
defer
me
.
startTimer
(
"Ioctl"
)()
return
me
.
original
.
Ioctl
(
header
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
Poll
(
header
*
InHeader
,
input
*
PollIn
)
(
out
*
PollOut
,
code
Status
)
{
defer
me
.
startTimer
(
"Poll"
)()
return
me
.
original
.
Poll
(
header
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
OpenDir
(
header
*
InHeader
,
input
*
OpenIn
)
(
flags
uint32
,
fuseFile
RawFuseDir
,
status
Status
)
{
defer
me
.
startTimer
(
"OpenDir"
)()
return
me
.
original
.
OpenDir
(
header
,
input
)
}
func
(
me
*
TimingRawFilesystem
)
Release
(
header
*
InHeader
,
f
RawFuseFile
)
{
defer
me
.
startTimer
(
"Release"
)()
me
.
original
.
Release
(
header
,
f
)
}
func
(
me
*
TimingRawFilesystem
)
ReleaseDir
(
header
*
InHeader
,
f
RawFuseDir
)
{
defer
me
.
startTimer
(
"ReleaseDir"
)()
me
.
original
.
ReleaseDir
(
header
,
f
)
}
fuse/wrappedfs.go
View file @
f819c7aa
...
...
@@ -81,3 +81,113 @@ func (me *WrappingPathFilesystem) Utimens(name string, AtimeNs uint64, CtimeNs u
}
////////////////////////////////////////////////////////////////
// Wrapping raw FS.
type
WrappingRawFilesystem
struct
{
original
RawFileSystem
}
func
(
me
*
WrappingRawFilesystem
)
Init
(
h
*
InHeader
,
input
*
InitIn
)
(
*
InitOut
,
Status
)
{
return
me
.
original
.
Init
(
h
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
Destroy
(
h
*
InHeader
,
input
*
InitIn
)
{
me
.
original
.
Destroy
(
h
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
Lookup
(
h
*
InHeader
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
return
me
.
original
.
Lookup
(
h
,
name
)
}
func
(
me
*
WrappingRawFilesystem
)
Forget
(
h
*
InHeader
,
input
*
ForgetIn
)
{
me
.
original
.
Forget
(
h
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
GetAttr
(
header
*
InHeader
,
input
*
GetAttrIn
)
(
out
*
AttrOut
,
code
Status
)
{
return
me
.
original
.
GetAttr
(
header
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
Open
(
header
*
InHeader
,
input
*
OpenIn
)
(
flags
uint32
,
fuseFile
RawFuseFile
,
status
Status
)
{
return
me
.
original
.
Open
(
header
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
SetAttr
(
header
*
InHeader
,
input
*
SetAttrIn
)
(
out
*
AttrOut
,
code
Status
)
{
return
me
.
original
.
SetAttr
(
header
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
Readlink
(
header
*
InHeader
)
(
out
[]
byte
,
code
Status
)
{
return
me
.
original
.
Readlink
(
header
)
}
func
(
me
*
WrappingRawFilesystem
)
Mknod
(
header
*
InHeader
,
input
*
MknodIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
return
me
.
original
.
Mknod
(
header
,
input
,
name
)
}
func
(
me
*
WrappingRawFilesystem
)
Mkdir
(
header
*
InHeader
,
input
*
MkdirIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
return
me
.
original
.
Mkdir
(
header
,
input
,
name
)
}
func
(
me
*
WrappingRawFilesystem
)
Unlink
(
header
*
InHeader
,
name
string
)
(
code
Status
)
{
return
me
.
original
.
Unlink
(
header
,
name
)
}
func
(
me
*
WrappingRawFilesystem
)
Rmdir
(
header
*
InHeader
,
name
string
)
(
code
Status
)
{
return
me
.
original
.
Rmdir
(
header
,
name
)
}
func
(
me
*
WrappingRawFilesystem
)
Symlink
(
header
*
InHeader
,
pointedTo
string
,
linkName
string
)
(
out
*
EntryOut
,
code
Status
)
{
return
me
.
original
.
Symlink
(
header
,
pointedTo
,
linkName
)
}
func
(
me
*
WrappingRawFilesystem
)
Rename
(
header
*
InHeader
,
input
*
RenameIn
,
oldName
string
,
newName
string
)
(
code
Status
)
{
return
me
.
original
.
Rename
(
header
,
input
,
oldName
,
newName
)
}
func
(
me
*
WrappingRawFilesystem
)
Link
(
header
*
InHeader
,
input
*
LinkIn
,
name
string
)
(
out
*
EntryOut
,
code
Status
)
{
return
me
.
original
.
Link
(
header
,
input
,
name
)
}
func
(
me
*
WrappingRawFilesystem
)
SetXAttr
(
header
*
InHeader
,
input
*
SetXAttrIn
)
Status
{
return
me
.
original
.
SetXAttr
(
header
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
GetXAttr
(
header
*
InHeader
,
input
*
GetXAttrIn
)
(
out
*
GetXAttrOut
,
code
Status
)
{
return
me
.
original
.
GetXAttr
(
header
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
Access
(
header
*
InHeader
,
input
*
AccessIn
)
(
code
Status
)
{
return
me
.
original
.
Access
(
header
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
Create
(
header
*
InHeader
,
input
*
CreateIn
,
name
string
)
(
flags
uint32
,
fuseFile
RawFuseFile
,
out
*
EntryOut
,
code
Status
)
{
return
me
.
original
.
Create
(
header
,
input
,
name
)
}
func
(
me
*
WrappingRawFilesystem
)
Bmap
(
header
*
InHeader
,
input
*
BmapIn
)
(
out
*
BmapOut
,
code
Status
)
{
return
me
.
original
.
Bmap
(
header
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
Ioctl
(
header
*
InHeader
,
input
*
IoctlIn
)
(
out
*
IoctlOut
,
code
Status
)
{
return
me
.
original
.
Ioctl
(
header
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
Poll
(
header
*
InHeader
,
input
*
PollIn
)
(
out
*
PollOut
,
code
Status
)
{
return
me
.
original
.
Poll
(
header
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
OpenDir
(
header
*
InHeader
,
input
*
OpenIn
)
(
flags
uint32
,
fuseFile
RawFuseDir
,
status
Status
)
{
return
me
.
original
.
OpenDir
(
header
,
input
)
}
func
(
me
*
WrappingRawFilesystem
)
Release
(
header
*
InHeader
,
f
RawFuseFile
)
{
me
.
original
.
Release
(
header
,
f
)
}
func
(
me
*
WrappingRawFilesystem
)
ReleaseDir
(
header
*
InHeader
,
f
RawFuseDir
)
{
me
.
original
.
ReleaseDir
(
header
,
f
)
}
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