Commit 990f3c11 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Make recording latency statistics optional.

parent bfe98501
......@@ -71,6 +71,7 @@ type MountState struct {
// For efficient reads and writes.
buffers *BufferPool
RecordStatistics bool
statisticsMutex sync.Mutex
operationCounts map[string]int64
......@@ -186,6 +187,7 @@ func (me *MountState) discardRequest(req *request) {
endNs := time.Nanoseconds()
dt := endNs - req.startNs
if me.RecordStatistics {
me.statisticsMutex.Lock()
defer me.statisticsMutex.Unlock()
......@@ -201,6 +203,7 @@ func (me *MountState) discardRequest(req *request) {
key = opname + "-write"
me.operationLatencies[key] += (endNs - req.preWriteNs)
me.operationCounts[key] += 1
}
me.buffers.FreeBuffer(req.inputBuf)
me.buffers.FreeBuffer(req.flatData)
......
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