Commit 53e99700 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Hide LatencyMap member in MountState

parent ae9dcc28
...@@ -29,7 +29,7 @@ type MountState struct { ...@@ -29,7 +29,7 @@ type MountState struct {
// For efficient reads and writes. // For efficient reads and writes.
buffers *BufferPoolImpl buffers *BufferPoolImpl
*LatencyMap latencies *LatencyMap
opts *MountOptions opts *MountOptions
kernelSettings InitIn kernelSettings InitIn
...@@ -88,9 +88,9 @@ func (me *MountState) Mount(mountPoint string, opts *MountOptions) error { ...@@ -88,9 +88,9 @@ func (me *MountState) Mount(mountPoint string, opts *MountOptions) error {
func (me *MountState) SetRecordStatistics(record bool) { func (me *MountState) SetRecordStatistics(record bool) {
if record { if record {
me.LatencyMap = NewLatencyMap() me.latencies = NewLatencyMap()
} else { } else {
me.LatencyMap = nil me.latencies = nil
} }
} }
...@@ -125,11 +125,11 @@ func NewMountState(fs RawFileSystem) *MountState { ...@@ -125,11 +125,11 @@ func NewMountState(fs RawFileSystem) *MountState {
} }
func (me *MountState) Latencies() map[string]float64 { func (me *MountState) Latencies() map[string]float64 {
return me.LatencyMap.Latencies(1e-3) return me.latencies.Latencies(1e-3)
} }
func (me *MountState) OperationCounts() map[string]int { func (me *MountState) OperationCounts() map[string]int {
return me.LatencyMap.Counts() return me.latencies.Counts()
} }
func (me *MountState) BufferPoolStats() string { func (me *MountState) BufferPoolStats() string {
...@@ -147,7 +147,7 @@ func (me *MountState) readRequest(req *request) Status { ...@@ -147,7 +147,7 @@ func (me *MountState) readRequest(req *request) Status {
n, err := me.mountFile.Read(req.inputBuf) n, err := me.mountFile.Read(req.inputBuf)
// If we start timing before the read, we may take into // If we start timing before the read, we may take into
// account waiting for input into the timing. // account waiting for input into the timing.
if me.LatencyMap != nil { if me.latencies != nil {
req.startNs = time.Nanoseconds() req.startNs = time.Nanoseconds()
} }
req.inputBuf = req.inputBuf[0:n] req.inputBuf = req.inputBuf[0:n]
...@@ -155,12 +155,12 @@ func (me *MountState) readRequest(req *request) Status { ...@@ -155,12 +155,12 @@ func (me *MountState) readRequest(req *request) Status {
} }
func (me *MountState) recordStats(req *request) { func (me *MountState) recordStats(req *request) {
if me.LatencyMap != nil { if me.latencies != nil {
endNs := time.Nanoseconds() endNs := time.Nanoseconds()
dt := endNs - req.startNs dt := endNs - req.startNs
opname := operationName(req.inHeader.opcode) opname := operationName(req.inHeader.opcode)
me.LatencyMap.AddMany( me.latencies.AddMany(
[]LatencyArg{ []LatencyArg{
{opname, "", dt}, {opname, "", dt},
{opname + "-write", "", endNs - req.preWriteNs}}) {opname + "-write", "", endNs - req.preWriteNs}})
...@@ -254,7 +254,7 @@ func (me *MountState) write(req *request) Status { ...@@ -254,7 +254,7 @@ func (me *MountState) write(req *request) Status {
log.Println(req.OutputDebug()) log.Println(req.OutputDebug())
} }
if me.LatencyMap != nil { if me.latencies != nil {
req.preWriteNs = time.Nanoseconds() req.preWriteNs = time.Nanoseconds()
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment